Skip to content

Commit

Permalink
chore(go): Update Go version to 1.17 (#335)
Browse files Browse the repository at this point in the history
* chore(go): Update Go version to 1.17

Required to build Darwin arm64 binaries for M1 (go 1.16+).

Go 1.16 is now archived - https://go.dev/dl/
Go 1.18 is the latest stable but has only just been released and might not be
widely available for users of this repo.
There hasn't been a patch (1.18.1) released yet either.

* chore(go): Update GHA to also use Go 1.17

* chore(lint): Update golangci-lint to 1.45.2
  • Loading branch information
kskewes-sf authored Apr 3, 2022
1 parent 22668fd commit a263c19
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 60 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Ensure code formatting and style is consistent
uses: golangci/golangci-lint-action@v2
with:
version: v1.32
version: v1.45.2

branch-build:
# Only run this on repositories in the 'spinnaker' org, not on forks.
Expand All @@ -37,7 +37,7 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: 1.15
go-version: 1.17
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Ensure code formatting and style is consistent
uses: golangci/golangci-lint-action@v2
with:
version: v1.32
version: v1.45.2

build:
runs-on: ubuntu-latest
Expand All @@ -28,7 +28,7 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: 1.15
go-version: 1.17
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Ensure code formatting and style is consistent
uses: golangci/golangci-lint-action@v2
with:
version: v1.32
version: v1.45.2

release:
runs-on: ubuntu-latest
Expand All @@ -44,7 +44,7 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: 1.15
go-version: 1.17
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
Expand Down
40 changes: 17 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ Interested in contributing to Spinnaker? Please review the [contribution documen

### Go

[Install Go 1.13.x](https://golang.org/doc/install).
[Install Go 1.17.x](https://golang.org/doc/install).

### Go modules

Clone the repository to a directory outside of your GOPATH:
Clone the repository:

```bash
$ git clone https://github.com/spinnaker/spin
Expand All @@ -28,7 +26,6 @@ To verify dependencies match checksums under go.sum, run `go mod verify`.

To clean up any old, unused go.mod or go.sum lines, run `go mod tidy`.


## Running Spin

Run using
Expand All @@ -37,41 +34,38 @@ Run using
./spin <cmds> <flags>
```


## Running tests

Test using
From the root `spin/` directory run:

```bash
go test -v ./...
```

from the root `spin/` directory.

## Updating the Gate API

Spin CLI uses [Swagger](https://swagger.io/) to generate the API client library for [Gate](https://github.com/spinnaker/gate).

Spin CLI's `master` should be using Gate's `master` swagger definition. Similarly, each [spin release version](https://github.com/spinnaker/spin/tags) `v{major}.{minor}.{patch}` semver should match [Gate's tag](https://github.com/spinnaker/gate/tags) `version-{major}.{minor}`.

Example:
| Spin CLI version | Gate version |
| ---------------- | ------------ |
| v1.17.3 | version-1.17.0 |
| v1.17.2 | version-1.17.0 |
| v1.17.1 | version-1.17.0 |

| Spin CLI version | Gate version |
| ---------------- | -------------- |
| v1.17.3 | version-1.17.0 |
| v1.17.2 | version-1.17.0 |
| v1.17.1 | version-1.17.0 |

To update the client library:

- Use the Swagger Codegen to generate the new library and drop it into the spin project
```bash
GATE_REPO_PATH=PATH_TO_YOUR_GATE_REPO
SWAGGER_CODEGEN_VERSION=$(cat gateapi/.swagger-codegen/VERSION)
rm -rf gateapi/ \
&& docker run -it \
-v "${GATE_REPO_PATH}/swagger/:/tmp/gate" \
-v "$PWD/gateapi/:/tmp/go/" \
"swaggerapi/swagger-codegen-cli:${SWAGGER_CODEGEN_VERSION}" generate -i /tmp/gate/swagger.json -l go -o /tmp/go/
```
```bash
GATE_REPO_PATH=PATH_TO_YOUR_GATE_REPO
SWAGGER_CODEGEN_VERSION=$(cat gateapi/.swagger-codegen/VERSION)
rm -rf gateapi/ \
&& docker run -it \
-v "${GATE_REPO_PATH}/swagger/:/tmp/gate" \
-v "$PWD/gateapi/:/tmp/go/" \
"swaggerapi/swagger-codegen-cli:${SWAGGER_CODEGEN_VERSION}" generate -i /tmp/gate/swagger.json -l go -o /tmp/go/
```
- Commit the changes and open a PR.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15 as build
FROM golang:1.17 as build
ARG VERSION=dev

WORKDIR /app
Expand Down
28 changes: 22 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
module github.com/spinnaker/spin

go 1.15
go 1.17

require (
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
github.com/antihax/optional v1.0.0
github.com/armon/go-radix v1.0.0 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.9 // indirect
github.com/mitchellh/cli v1.0.0
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce
github.com/pkg/errors v0.9.1
github.com/posener/complete v1.2.1 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/spf13/cobra v0.0.5
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
k8s.io/client-go v0.20.2
sigs.k8s.io/yaml v1.2.0
)

require (
cloud.google.com/go v0.54.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.9 // indirect
github.com/posener/complete v1.2.1 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd // indirect
google.golang.org/appengine v1.6.5 // indirect
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
)
Loading

0 comments on commit a263c19

Please sign in to comment.