Skip to content

Commit

Permalink
update packages and github build (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexei-led authored Mar 24, 2024
1 parent e374e39 commit dd8775d
Show file tree
Hide file tree
Showing 6 changed files with 253 additions and 192 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,27 @@ jobs:

runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message,'[skip ci]') }}
container: golang:1.21-alpine
steps:
- name: checkout
uses: actions/checkout@v4

- name: setup go
uses: actions/setup-go@v5
with:
go-version: 1.22

- name: lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.57.1
skip-pkg-cache: true
args: --config .golangci.yaml --verbose ./...

- name: test
shell: sh
env:
CGO_ENABLED: 0
run: |
apk --update add ca-certificates tzdata make git bash
make lint
make test-json
- name: upload test results
Expand Down Expand Up @@ -95,7 +104,7 @@ jobs:

- name: prepare meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}-agent
tags: |
Expand Down
44 changes: 33 additions & 11 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ linters-settings:
check-shadowing: true
gocyclo:
min-complexity: 15
gocognit:
min-complexity: 35
maligned:
suggest-new: true
dupl:
Expand All @@ -34,6 +32,9 @@ linters-settings:
- "cancelled"
goimports:
local-prefixes: github.com/golangci/golangci-lint
gosec:
excludes:
- G601
gocritic:
enabled-tags:
- diagnostic
Expand All @@ -52,27 +53,34 @@ linters-settings:
funlen:
lines: 105
statements: 50
tagliatelle:
case:
use-field-name: true
rules:
json: snake

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
# - containedctx
# - contextcheck disabled because of generics
- dupword
- contextcheck
- decorder
# - depguard
- dogsled
- dupword
- dupl
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
- execinquery
- exhaustive
# - exhaustivestruct TODO: check how to fix it
- exportloopref
Expand All @@ -82,20 +90,24 @@ linters:
- gci
# - gochecknoglobals TODO: remove globals from code
# - gochecknoinits TODO: remove main.init
- gochecksumtype
- gocognit
- goconst
- gocritic
- gocyclo
# - godox
# - godot
# - godox
- goerr113
- gofmt
- goimports
- gomnd
# - gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- goprintffuncname
- gosmopolitan
- grouper
- importas
# - ireturn TODO: not sure if it is a good linter
Expand All @@ -104,34 +116,44 @@ linters:
- loggercheck
- maintidx
- makezero
- mirror
- misspell
- musttag
- nakedret
# - nestif
- nilerr
- nilnil
# - noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
- paralleltest
- perfsprint
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- revive
# - rowserrcheck disabled because of generics
# - staticcheck doesn't work with go1.19
# - structcheck disabled because of generics
- sloglint
- spancheck
- sqlclosecheck
# - staticcheck
- stylecheck
# - tagalign
# - tagliatelle
- tenv
- testableexamples
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
# - varnamelen TODO: review naming
# - varcheck depricated 1.49
# - wastedassign disabled because of generics
- whitespace
- wrapcheck
# - wsl
- zerologlint

issues:
exclude-rules:
Expand Down
4 changes: 2 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func run(c context.Context, log *logrus.Entry, cfg *config.Config) error {
if cfg.ReleaseOnExit {
log.Infof("releasing static public IP address")
// use a different context for releasing the static public IP address since the main context is canceled
if err = assigner.Unassign(context.Background(), n.Instance, n.Zone); err != nil {
if err = assigner.Unassign(context.Background(), n.Instance, n.Zone); err != nil { //nolint:contextcheck
return errors.Wrap(err, "releasing static public IP address")
}
}
Expand Down Expand Up @@ -286,7 +286,7 @@ func main() {
Usage: "replaces the node's public IP address with a static public IP (IPv4/IPv6) address",
Version: version,
}
cli.VersionPrinter = func(c *cli.Context) {
cli.VersionPrinter = func(_ *cli.Context) {
fmt.Printf("kubeip-agent %s\n", version)
fmt.Printf(" Build date: %s\n", buildDate)
fmt.Printf(" Git commit: %s\n", gitCommit)
Expand Down
109 changes: 58 additions & 51 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,53 @@ go 1.21

require (
cloud.google.com/go/compute/metadata v0.2.3
github.com/aws/aws-sdk-go-v2 v1.21.1
github.com/aws/aws-sdk-go-v2/config v1.18.44
github.com/aws/aws-sdk-go-v2/service/ec2 v1.124.0
github.com/aws/aws-sdk-go-v2 v1.26.0
github.com/aws/aws-sdk-go-v2/config v1.27.9
github.com/aws/aws-sdk-go-v2/service/ec2 v1.152.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.3
github.com/urfave/cli/v2 v2.25.7
google.golang.org/api v0.143.0
k8s.io/api v0.28.1
k8s.io/apimachinery v0.28.1
k8s.io/client-go v0.28.1
sigs.k8s.io/controller-runtime v0.16.2
github.com/stretchr/testify v1.9.0
github.com/urfave/cli/v2 v2.27.1
google.golang.org/api v0.171.0
k8s.io/api v0.29.3
k8s.io/apimachinery v0.29.3
k8s.io/client-go v0.29.3
sigs.k8s.io/controller-runtime v0.17.2
)

require (
cloud.google.com/go/compute v1.23.0 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.42 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.12 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.42 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.36 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.44 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.36 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.15.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.23.1 // indirect
github.com/aws/smithy-go v1.15.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
cloud.google.com/go/compute v1.25.1 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.9 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.5 // indirect
github.com/aws/smithy-go v1.20.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.3 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand All @@ -59,27 +61,32 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/term v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/grpc v1.57.1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20240322212309-b815d8309940 // indirect
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading

0 comments on commit dd8775d

Please sign in to comment.