Skip to content

Commit

Permalink
Create go.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
laduke committed Aug 15, 2024
1 parent f1e78e4 commit cd9c325
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
54 changes: 54 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
golangci:
name: lint
runs-on: gha-runner-x64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: v1.20
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59

build:
name: build
runs-on: gha-runner-x64
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Build
run: go build -v ./...

test:
if: github.repository_owner == 'zerotier'
name: test
runs-on: gha-runner-x64
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Test
env:
ZEROTIER_CENTRAL_TOKEN: ${{ secrets.ZEROTIER_CENTRAL_TOKEN }}
run: |
go test -v ./...
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (c *Client) RoundTrip(req *http.Request) (*http.Response, error) {
req.Header.Set("Authorization", fmt.Sprintf("bearer %s", c.apiKey))

if c.limits.Limit != 0 && c.limits.Remaining < c.limits.Limit {
diff := time.Now().Add(time.Duration(c.limits.Limit-c.limits.Remaining) * 10 * time.Millisecond).Sub(time.Now())
diff := time.Until(time.Now().Add(time.Duration(c.limits.Limit-c.limits.Remaining) * 10 * time.Millisecond))
time.Sleep(diff)
}

Expand Down

0 comments on commit cd9c325

Please sign in to comment.