Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated dependencies, now using golangci-lint, fix deprecated API usage, and removed vendor directory. #114

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 8 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: 1.20.1
go-version: stable

- name: Lint
run: make lint
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
args: --timeout=5m
version: v1.59

- name: Test
run: make test
26 changes: 14 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# For details see:
# - https://golangci-lint.run/usage/configuration/
# - https://golangci-lint.run/usage/linters/

run:
deadline: 1m
modules-download-mode: vendor
tests: true
issues-exit-code: 2
modules-download-mode: readonly

linters:
enable-all: true
disable:
- lll
output:
sort-results: true

linters-settings:
gocyclo:
min-complexity: 12
gofmt:
simplify: true
linters:
disable-all: true
enable:
- gofmt
- govet
- staticcheck
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG GO_VERSION=1.18.3
ARG GO_VERSION=1.21.12
FROM golang:${GO_VERSION}-alpine AS builder
ENV GOFLAGS -mod=vendor
ENV GOFLAGS -mod=readonly
RUN apk --update add ca-certificates make upx git
WORKDIR /go/src/github.com/cruise-automation/daytona
COPY . .
Expand Down
27 changes: 15 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,46 @@

VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always --tags)
VERSION_TAG=$(VERSION:v%=%) # drop the v-prefix for docker images, per convention
PACKAGES=$(shell go list ./... | grep -v /vendor/)
GOFILES=$(shell find . -type f -name '*.go' -not -path "./vendor/*")
PACKAGES=$(shell go list -mod=readonly ./...)
GOFILES=$(shell find . -type f -name '*.go')
GO_LDFLAGS=-ldflags '-s -w -X main.version=${VERSION}'

.PHONY: entry test lint build image push-image

.PHONY: entry
entry:
@echo "These are your options:"
@cat Makefile

.PHONY: check
check:
ifndef VERSION_TAG
$(error VERSION_TAG must be set for image management)
endif

.PHONY: test
test:
go test -race -cover -count=1 -v ${PACKAGES}
go test -race -cover -count=1 -v -mod=readonly ${PACKAGES}

.PHONY: coverage
coverage:
go test -cover -count=1 -coverprofile=coverage.out -v ${PACKAGES}
go tool cover -html=coverage.out

.PHONY: lint
lint:
go vet ${PACKAGES}
gofmt -d -l ${GOFILES}
test -z $(shell gofmt -d -l ${GOFILES})
GO111MODULE=off \
go get -u golang.org/x/lint/golint
golint -set_exit_status ${PACKAGES}
@command -v golangci-lint || (echo "golangci-lint not installed. See https://golangci-lint.run/welcome/install/"; exit 1)
@golangci-lint version
golangci-lint run --timeout=5m ./...

.PHONY: build
build:
CGO_ENABLED=0 go build ${GO_LDFLAGS} -o daytona cmd/daytona/main.go
CGO_ENABLED=0 go build ${GO_LDFLAGS} -mod=readonly -o daytona cmd/daytona/main.go
@command -v upx && upx daytona || echo "[INFO] No upx installed, not compressing."

.PHONY: image
image: check
docker build -t daytona:${VERSION_TAG} .

.PHONY: push-image
push-image: check
@if test "$(REGISTRY)" = "" ; then \
echo "REGISTRY but must be set in order to continue"; \
Expand Down
68 changes: 40 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,39 +1,47 @@
module github.com/cruise-automation/daytona

go 1.20
go 1.21

toolchain go1.22.1

require (
cloud.google.com/go/compute/metadata v0.2.3
github.com/aws/aws-sdk-go v1.44.220
cloud.google.com/go/compute/metadata v0.5.0
github.com/aws/aws-sdk-go v1.54.18
github.com/briankassouf/jose v0.9.2-0.20180619214549-d2569464773f
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-gcp-common v0.8.0
github.com/hashicorp/vault/api v1.9.0
github.com/hashicorp/go-gcp-common v0.9.0
github.com/hashicorp/vault/api v1.14.0
github.com/mitchellh/go-homedir v1.1.0
github.com/rs/zerolog v1.29.0
github.com/stretchr/testify v1.8.2
golang.org/x/oauth2 v0.6.0
google.golang.org/api v0.112.0
github.com/rs/zerolog v1.33.0
github.com/stretchr/testify v1.9.0
golang.org/x/oauth2 v0.21.0
google.golang.org/api v0.188.0
gopkg.in/square/go-jose.v2 v2.6.0
)

require (
cloud.google.com/go/compute v1.18.0 // indirect
github.com/cenkalti/backoff/v3 v3.0.0 // indirect
cloud.google.com/go/auth v0.7.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.3 // indirect
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-jose/go-jose/v4 v4.0.3 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/s2a-go v0.1.7 // 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.5 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.6 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
Expand All @@ -42,17 +50,21 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488 // indirect
google.golang.org/grpc v1.53.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading