Skip to content

Commit

Permalink
chore: update Go, CI, and linter
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Sep 7, 2023
1 parent 64a0a5b commit 6ed00b5
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 49 deletions.
29 changes: 6 additions & 23 deletions .github/workflows/go-cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,20 @@ jobs:

strategy:
matrix:
go-version: [ 1.19, 1.x ]
go-version: [ stable, oldstable ]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
# https://github.com/marketplace/actions/setup-go-environment
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

# https://github.com/marketplace/actions/checkout
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

# https://github.com/marketplace/actions/cache
- name: Cache Go modules
uses: actions/cache@v3
# https://github.com/marketplace/actions/setup-go-environment
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
go-version: ${{ matrix.go-version }}

- name: Test
run: go test -v -cover ./...
Expand Down
23 changes: 7 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,23 @@ jobs:
name: Main Process
runs-on: ubuntu-latest
env:
GO_VERSION: 1.19
GOLANGCI_LINT_VERSION: v1.50.1
GO_VERSION: stable
GOLANGCI_LINT_VERSION: v1.54.2
CGO_ENABLED: 0

steps:

# https://github.com/marketplace/actions/setup-go-environment
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}

# https://github.com/marketplace/actions/checkout
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

# https://github.com/marketplace/actions/cache
- name: Cache Go modules
uses: actions/cache@v3
# https://github.com/marketplace/actions/setup-go-environment
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: ${{ env.GO_VERSION }}

- name: Check and get dependencies
run: |
Expand Down
12 changes: 7 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ linters-settings:
gofumpt:
extra-rules: true
depguard:
list-type: blacklist
include-go-root: false
packages:
- github.com/sirupsen/logrus
- github.com/pkg/errors
rules:
main:
deny:
- pkg: "github.com/instana/testify"
desc: not allowed
- pkg: "github.com/pkg/errors"
desc: Should be replaced by standard lib errors package
gocritic:
enabled-tags:
- diagnostic
Expand Down
2 changes: 1 addition & 1 deletion contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@ type ContactInfoResponse struct {

// ContactListResponse API model.
type ContactListResponse struct {
Count int
Count int `mapstructure:"count"`
Contacts []Contact `mapstructure:"contact"`
}
2 changes: 1 addition & 1 deletion domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ type DomainListRequest struct {

// DomainList API model.
type DomainList struct {
Count int
Count int `mapstructure:"count"`
Domains []DomainInfoResponse `mapstructure:"domain"`
}

Expand Down
6 changes: 3 additions & 3 deletions nameserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ func (s *NameserverService) FindRecordByID(recID int) (*NameserverRecord, *Names

// NameserverCheckResponse API model.
type NameserverCheckResponse struct {
Details []string
Status string
Details []string `mapstructure:"details"`
Status string `mapstructure:"status"`
}

// NameserverRecordRequest API model.
Expand Down Expand Up @@ -269,7 +269,7 @@ type NameserverRecord struct {

// NamserverListResponse API model.
type NamserverListResponse struct {
Count int
Count int `mapstructure:"count"`
Domains []NameserverDomain `mapstructure:"domains"`
}

Expand Down

0 comments on commit 6ed00b5

Please sign in to comment.