Skip to content

Commit

Permalink
feat: upgrade Go to 1.21 (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlourenc authored Oct 26, 2023
1 parent 75de44c commit c39ca8f
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 252 deletions.
28 changes: 7 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
version: 2.1

orbs:
go: circleci/go@1.7.1
go: circleci/go@1.9.0
publish: snyk/publish@1
snyk: snyk/snyk@1

defaults: &defaults
resource_class: small
working_directory: ~/vervet
docker:
- image: cimg/go:1.20-node
- image: cimg/go:1.21-node

test_vu_defaults: &test_vu_defaults
resource_class: medium
working_directory: ~/vervet/vervet-underground
machine:
image: ubuntu-2004:202201-02
image: ubuntu-2004:2023.10.1

vu_defaults: &vu_defaults
resource_class: small
working_directory: ~/vervet/vervet-underground
docker:
- image: cimg/go:1.20-node
- image: cimg/go:1.21-node
environment:
DOCKER_BUILDKIT: 1

Expand Down Expand Up @@ -48,7 +49,6 @@ commands:
setup_build_remote_docker:
steps:
- setup_remote_docker:
version: 20.10.14
docker_layer_caching: false

jobs:
Expand All @@ -59,8 +59,6 @@ jobs:
name: Install spectral
command: sudo npm install -g @stoplight/[email protected]
- checkout
- attach_workspace:
at: ~/vervet
- go/mod-download-cached
- run:
name: Verify testdata/output up to date
Expand All @@ -71,17 +69,11 @@ jobs:

test-vu:
<<: *test_vu_defaults
working_directory: ~/vervet/vervet-underground
steps:
- checkout:
path: ~/vervet
- run:
name: Install Go
command: |-
sudo rm -rf /usr/local/go && curl -sSL -o /tmp/go.tar.gz "https://go.dev/dl/go1.20.3.linux-amd64.tar.gz" && sudo tar -xz -f /tmp/go.tar.gz -C /usr/local
sudo ln -s /usr/local/go/bin/go /usr/local/bin/go
- attach_workspace:
at: ~/vervet
- go/install:
version: 1.21.3
- go/mod-download-cached
- run:
command: make test
Expand All @@ -91,8 +83,6 @@ jobs:
- image: golangci/golangci-lint:v1.51.0
steps:
- checkout
- attach_workspace:
at: ~/vervet
- run:
command: golangci-lint run -v ./...

Expand All @@ -101,8 +91,6 @@ jobs:
- image: golangci/golangci-lint:v1.51.0
steps:
- checkout
- attach_workspace:
at: ~/vervet
- run:
command: cd vervet-underground && golangci-lint run -v ./...

Expand Down Expand Up @@ -137,8 +125,6 @@ jobs:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/vervet
- run: |-
go install github.com/caarlos0/svu@latest
export VERSION=$(svu next)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ GO_BIN=$(shell pwd)/.bin/go

SHELL:=env PATH=$(GO_BIN):$(PATH) $(SHELL)

GOCI_LINT_V?=v1.51.0
GOCI_LINT_V?=v1.54.2

.PHONY: all
all: lint test build
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/snyk/vervet/v5

go 1.20
go 1.21

require (
github.com/bmatcuk/doublestar/v4 v4.6.0
Expand Down
2 changes: 0 additions & 2 deletions internal/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,6 @@ func (g *Generator) Scope() config.GeneratorScope {

// execute the Generator. If generated artifacts already exist, a warning
// is logged but the file is not overwritten, unless force is true.
//
// TODO: in Go 1.18, declare scope as an interface{ VersionScope | ResourceScope }.
func (g *Generator) execute(scope interface{}) ([]string, error) {
if g.files != nil {
return g.runFiles(scope)
Expand Down
32 changes: 31 additions & 1 deletion versionware/example/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/snyk/vervet/v5/versionware/example

go 1.16
go 1.21

require (
github.com/frankban/quicktest v1.13.0
Expand All @@ -12,4 +12,34 @@ require (
github.com/snyk/vervet/v5 v5.1.1
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bmatcuk/doublestar/v4 v4.6.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/invopop/yaml v0.2.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/perimeterx/marshmallow v1.1.4 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.28.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/rogpeppe/go-internal v1.6.1 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/sys v0.13.0 // indirect
google.golang.org/protobuf v1.26.0-rc.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/snyk/vervet/v5 => ../..
Loading

0 comments on commit c39ca8f

Please sign in to comment.