Skip to content

Commit

Permalink
chore(*) improve go mod handling in 1.14 (#813)
Browse files Browse the repository at this point in the history
* chore(*) improve go mod handling in 1.14

Having a folder called `vendor` confuses go 1.14. Rename it to `vendored`
and this solves many potential issues. Including the need to pass `-mod=mod`
in many cases.

https://github.com/Kong/kuma/pull/718#issuecomment-625894360

* fix(ci) make sure to install git before `checkout`

* chore(ci) bump Xcode to 11.5 an Ubuntu to 18.04

Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
  • Loading branch information
Nikolay Nikolaev authored Jun 9, 2020
1 parent d466650 commit 3dfed93
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 11 deletions.
13 changes: 7 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ executors:
mac:
resource_class: large
macos:
xcode: "9.0"
xcode: "11.5.0"
environment:
GO_VERSION: *go_version
GO111MODULE: "on"
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:

dev_ubuntu:
docker:
- image: ubuntu:16.04
- image: ubuntu:18.04
environment:
GO_VERSION: *go_version
GO111MODULE: "on"
Expand All @@ -88,16 +88,17 @@ jobs:
# "ERRO Running error: context loading failed: failed to load program with go/packages: could not determine GOARCH and Go compiler"
GOPATH: /root/.go-kuma-go
steps:
- checkout
- run:
name: "Install pre-requirements"
name: "Install prerequisites"
# make sure to deploy `git` befor checking out the code, otherwise Circle uses its own version, which behaves differently
# `unzip` is necessary to install `protoc`
# `gcc` is necessary to run `go test -race`
command: apt update && apt install -y unzip gcc
command: |
apt update && apt install -y curl git make unzip gcc
- checkout
- run:
name: "Install Go"
command: |
apt update && apt install -y curl git make
# see https://golang.org/doc/install#tarball
curl -L https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -xz -C $HOME
- run:
Expand Down
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ go.sum
Makefile*
pkg/*
!pkg/config/*
vendor
vendored
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ build_info_ld_flags := $(foreach entry,$(build_info_fields), -X github.com/Kong/
LD_FLAGS := -ldflags="-s -w $(build_info_ld_flags)"
GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
GOFLAGS := -mod=mod
GOFLAGS :=
GO_BUILD := GOOS=${GOOS} GOARCH=${GOARCH} CGO_ENABLED=0 go build -v $(GOFLAGS) $(LD_FLAGS)
GO_RUN := CGO_ENABLED=0 go run $(GOFLAGS) $(LD_FLAGS)
GO_TEST := go test $(GOFLAGS) $(LD_FLAGS)
Expand Down Expand Up @@ -243,7 +243,7 @@ golangci-lint: ## Dev: Runs golangci-lint linter
$(GOLANGCI_LINT_DIR)/golangci-lint run -v

imports: ## Dev: Runs goimports in order to organize imports
goimports -w -local github.com/Kong/kuma -d `find . -type f -name '*.go' -not -name '*.pb.go' -not -path './vendor/*'`
goimports -w -local github.com/Kong/kuma -d `find . -type f -name '*.go' -not -name '*.pb.go' -not -path './vendored/*'`

check: generate fmt vet docs golangci-lint imports tidy ## Dev: Run code checks (go fmt, go vet, ...)
make generate manifests -C pkg/plugins/resources/k8s/native
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ replace (
github.com/Kong/kuma/api => ./api
github.com/Kong/kuma/pkg/plugins/resources/k8s/native => ./pkg/plugins/resources/k8s/native

github.com/prometheus/prometheus => ./vendor/github.com/prometheus/prometheus
github.com/prometheus/prometheus => ./vendored/github.com/prometheus/prometheus
github.com/spiffe/spire/proto/spire => github.com/spiffe/spire/proto/spire v0.10.0
gopkg.in/fsnotify.v1 => gopkg.in/fsnotify.v1 v1.4.7
k8s.io/client-go => k8s.io/client-go v0.18.2
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/resources/k8s/native/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bin

# Kubernetes Generated files - skip generated files, except for vendored files

!vendor/**/zz_generated.*
!vendored/**/zz_generated.*

# editor and IDE paraphernalia
.idea
Expand Down
File renamed without changes.

0 comments on commit 3dfed93

Please sign in to comment.