Skip to content

Commit

Permalink
upgrade to go 1.17 and make tests more robust (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicks authored Oct 27, 2021
1 parent 9554114 commit 2fdc036
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .circleci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Similar to the release image (which contains everything BUT the build
# toolchain)

FROM golang:1.16-buster
FROM golang:1.17-buster

RUN apt update && apt install -y curl ca-certificates liblz4-tool rsync socat

Expand Down
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ orbs:
jobs:
build:
docker:
- image: circleci/golang:1.16
- image: circleci/golang:1.17
working_directory: /go/src/github.com/tilt-dev/ctlptl
steps:
- checkout
Expand Down Expand Up @@ -36,9 +36,9 @@ jobs:
- kubernetes/install-kubectl
- run: |
set -ex
wget https://golang.org/dl/go1.16.2.linux-amd64.tar.gz
wget https://golang.org/dl/go1.17.2.linux-amd64.tar.gz
sudo rm -fR /usr/local/go
sudo tar -C /usr/local -xzf go1.16.2.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.17.2.linux-amd64.tar.gz
- run: |
set -ex
export MINIKUBE_VERSION=v1.15.0
Expand All @@ -60,7 +60,7 @@ jobs:

release-dry-run:
docker:
- image: circleci/golang:1.16
- image: circleci/golang:1.17
steps:
- checkout
- setup_remote_docker:
Expand All @@ -74,7 +74,7 @@ jobs:

release:
docker:
- image: circleci/golang:1.16
- image: circleci/golang:1.17
steps:
- checkout
- setup_remote_docker:
Expand Down
4 changes: 4 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ builds:
goarch:
- amd64
- arm64
# https://goreleaser.com/deprecations/#builds-for-windowsarm64
ignore:
- goos: windows
goarch: arm64
archives:
- name_template: "{{ .ProjectName }}.{{ .Version }}.{{ .Os }}.{{ .Arch }}"
replacements:
Expand Down
104 changes: 85 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,45 +1,111 @@
module github.com/tilt-dev/ctlptl

go 1.16
go 1.17

require (
cloud.google.com/go v0.56.0 // indirect
github.com/Microsoft/go-winio v0.4.14 // indirect
github.com/blang/semver/v4 v4.0.0
github.com/containerd/containerd v1.4.1 // indirect
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v17.12.0-ce-rc1.0.20200730172259-9f28837c1d93+incompatible
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/google/go-cmp v0.5.5
github.com/gorilla/mux v1.8.0 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/moby/term v0.0.0-20200915141129-7f0af18e79f2 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/onsi/ginkgo v1.14.2 // indirect
github.com/onsi/gomega v1.10.4 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/pkg/errors v0.9.1
github.com/shirou/gopsutil/v3 v3.21.2
github.com/sirupsen/logrus v1.8.0 // indirect
github.com/spf13/cobra v1.1.3
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
github.com/tilt-dev/localregistry-go v0.0.0-20201021185044-ffc4c827f097
github.com/tilt-dev/wmclient v0.0.0-20201109174454-1839d0355fbc
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
gotest.tools/v3 v3.0.3 // indirect
k8s.io/api v0.22.2
k8s.io/apimachinery v0.22.2
k8s.io/cli-runtime v0.22.2
k8s.io/client-go v0.22.2
k8s.io/klog/v2 v2.9.0
sigs.k8s.io/kind v0.9.0
)

require (
cloud.google.com/go v0.56.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.18 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/Microsoft/go-winio v0.4.14 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/containerd/containerd v1.4.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/denisbrodbeck/machineid v1.0.0 // indirect
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/go-errors/errors v1.0.1 // indirect
github.com/go-logr/logr v0.4.0 // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/magefile/mage v1.10.0 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/moby/term v0.0.0-20200915141129-7f0af18e79f2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/onsi/ginkgo v1.14.2 // indirect
github.com/onsi/gomega v1.10.4 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/sirupsen/logrus v1.8.0 // indirect
github.com/tklauser/go-sysconf v0.3.4 // indirect
github.com/tklauser/numcpus v0.2.1 // indirect
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
google.golang.org/appengine v1.6.5 // indirect
google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154 // indirect
google.golang.org/grpc v1.28.0 // indirect
google.golang.org/protobuf v1.26.0 // indirect
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gotest.tools/v3 v3.0.3 // indirect
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e // indirect
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a // indirect
sigs.k8s.io/kustomize/api v0.8.11 // indirect
sigs.k8s.io/kustomize/kyaml v0.11.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)
2 changes: 1 addition & 1 deletion internal/socat/socat.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *Controller) ConnectRemoteDockerPort(ctx context.Context, port int) erro
// on the same machine.
func (c *Controller) StartRemotePortforwarder(ctx context.Context) error {
container, err := c.client.ContainerInspect(ctx, serviceName)
if err == nil && container.State.Running {
if err == nil && (container.ContainerJSONBase != nil && container.State.Running) {
// The service is already running!
return nil
} else if err == nil {
Expand Down
2 changes: 2 additions & 0 deletions pkg/registry/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ type fixture struct {
}

func newFixture(t *testing.T) *fixture {
_ = os.Setenv("DOCKER_HOST", "")

d := &fakeDocker{}
controller, err := NewController(
genericclioptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr}, d)
Expand Down

0 comments on commit 2fdc036

Please sign in to comment.