From 88ef42393429b008317f0364ef99a2e381bfa525 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 5 Apr 2022 09:53:23 +0200 Subject: [PATCH 1/6] CI: Only test with the last two versions of Golang. Currently this is Go 1.17 and 1.18. --- .github/workflows/test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ad4b7b7..d415afe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,10 +21,6 @@ jobs: strategy: matrix: go-version: - - "1.13" - - "1.14" - - "1.15" - - "1.16" - "1.17" - "1.18" runs-on: ubuntu-latest From dcc47231547184b10821b95ff74687b68b583840 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 5 Apr 2022 09:55:16 +0200 Subject: [PATCH 2/6] Update minimum version in readme. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9aae0f5..168b615 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ information on the API of the signaling server. The following tools are required for building the signaling server. - git -- go >= 1.13 +- go >= 1.17 - make All other dependencies are fetched automatically while building. From 3cc074896ad81216c5f6db849f103e4a5370d8b0 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 5 Apr 2022 09:57:13 +0200 Subject: [PATCH 3/6] go.mod: Update version to 1.17 and run "go mod tidy". --- go.mod | 44 +++++++++++++++++++++++++++++++++++++++----- go.sum | 3 --- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 507ce23..ada45e8 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,10 @@ module github.com/strukturag/nextcloud-spreed-signaling -go 1.13 +go 1.17 require ( github.com/dlintw/goconf v0.0.0-20120228082610-dcc070983490 github.com/golang-jwt/jwt v3.2.1+incompatible - github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect github.com/google/uuid v1.3.0 github.com/gorilla/mux v1.8.0 github.com/gorilla/securecookie v1.1.1 @@ -18,7 +17,42 @@ require ( github.com/pion/sdp v1.3.0 github.com/prometheus/client_golang v1.11.0 go.etcd.io/etcd v0.5.0-alpha.5.0.20210226220824-aa7126864d82 - go.uber.org/zap v1.13.0 // indirect - golang.org/x/tools v0.0.0-20200103221440-774c71fcf114 // indirect - google.golang.org/protobuf v1.26.0 // indirect +) + +require ( + github.com/BurntSushi/toml v0.3.1 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.1.1 // indirect + github.com/coreos/go-semver v0.2.0 // indirect + github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7 // indirect + github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf // indirect + github.com/gogo/protobuf v1.2.1 // indirect + github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect + github.com/golang/protobuf v1.5.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/klauspost/compress v1.11.12 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/minio/highwayhash v1.0.1 // indirect + github.com/nats-io/jwt/v2 v2.0.2 // indirect + github.com/nats-io/nkeys v0.3.0 // indirect + github.com/nats-io/nuid v1.0.1 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.26.0 // indirect + github.com/prometheus/procfs v0.6.0 // indirect + go.uber.org/atomic v1.5.0 // indirect + go.uber.org/multierr v1.3.0 // indirect + go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee // indirect + go.uber.org/zap v1.13.0 // indirect + golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b // indirect + golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect + golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect + golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 // indirect + golang.org/x/text v0.3.3 // indirect + golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 // indirect + golang.org/x/tools v0.0.0-20200103221440-774c71fcf114 // indirect + google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect + google.golang.org/grpc v1.26.0 // indirect + google.golang.org/protobuf v1.26.0 // indirect + honnef.co/go/tools v0.0.1-2019.2.3 // indirect ) diff --git a/go.sum b/go.sum index 876e82d..f34f60c 100644 --- a/go.sum +++ b/go.sum @@ -116,10 +116,8 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= @@ -322,7 +320,6 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= From 320f643a8724061f75bd1dc8c8cfbb188c6aea2f Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 5 Apr 2022 10:17:33 +0200 Subject: [PATCH 4/6] make: Update for Go 1.17+ --- Makefile | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index a52a29c..9ed9c35 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ all: build GO := $(shell which go) -GOPATH := "$(CURDIR)/vendor:$(CURDIR)" +GOPATH := $(shell "$(GO)" env GOPATH) GOFMT := "$(shell dirname "$(GO)")/gofmt" GOOS ?= linux GOARCH ?= amd64 @@ -43,19 +43,17 @@ TESTARGS := $(TESTARGS) -count $(COUNT) endif ifeq ($(GOARCH), amd64) -VENDORBIN := $(CURDIR)/vendor/bin +GOPATHBIN := $(GOPATH)/bin else -VENDORBIN := $(CURDIR)/vendor/bin/$(GOOS)_$(GOARCH) +GOPATHBIN := $(GOPATH)/bin/$(GOOS)_$(GOARCH) endif hook: [ ! -d "$(CURDIR)/.git/hooks" ] || ln -sf "$(CURDIR)/scripts/pre-commit.hook" "$(CURDIR)/.git/hooks/pre-commit" -./vendor/bin/easyjson: - GOPATH=$(GOPATH) $(GO) get -u github.com/mailru/easyjson/... - @if dpkg --compare-versions "$(GOVERSION)" "ge" "1.17" ; then \ - GOPATH=$(GOPATH) $(GO) install github.com/mailru/easyjson/...; \ - fi +$(GOPATHBIN)/bin/easyjson: + $(GO) get -u -d github.com/mailru/easyjson/... + $(GO) install github.com/mailru/easyjson/... continentmap.go: $(CURDIR)/scripts/get_continent_map.py $@ @@ -69,7 +67,7 @@ check-continentmap: rm -rf $$TMP get: - GOPATH=$(GOPATH) $(GO) get $(PACKAGE) + $(GO) get $(PACKAGE) fmt: hook $(GOFMT) -s -w *.go client proxy server @@ -82,18 +80,18 @@ test: vet common cover: vet common rm -f cover.out && \ - GOPATH=$(GOPATH) $(GO) test -v -timeout $(TIMEOUT) -coverprofile cover.out $(ALL_PACKAGES) && \ + $(GO) test -v -timeout $(TIMEOUT) -coverprofile cover.out $(ALL_PACKAGES) && \ sed -i "/_easyjson/d" cover.out && \ - GOPATH=$(GOPATH) $(GO) tool cover -func=cover.out + $(GO) tool cover -func=cover.out coverhtml: vet common rm -f cover.out && \ - GOPATH=$(GOPATH) $(GO) test -v -timeout $(TIMEOUT) -coverprofile cover.out $(ALL_PACKAGES) && \ + $(GO) test -v -timeout $(TIMEOUT) -coverprofile cover.out $(ALL_PACKAGES) && \ sed -i "/_easyjson/d" cover.out && \ - GOPATH=$(GOPATH) $(GO) tool cover -html=cover.out -o coverage.html + $(GO) tool cover -html=cover.out -o coverage.html -%_easyjson.go: %.go ./vendor/bin/easyjson - PATH=$(shell dirname $(GO)):$(PATH) GOPATH=$(GOPATH) "$(VENDORBIN)/easyjson" -all $*.go +%_easyjson.go: %.go $(GOPATHBIN)/bin/easyjson + "$(GOPATHBIN)/easyjson" -all $*.go common: \ api_signaling_easyjson.go \ @@ -101,18 +99,19 @@ common: \ api_proxy_easyjson.go \ natsclient_easyjson.go \ room_easyjson.go + $(GO) mod tidy $(BINDIR): mkdir -p $(BINDIR) client: common $(BINDIR) - GOPATH=$(GOPATH) $(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o $(BINDIR)/client ./client/... + $(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o $(BINDIR)/client ./client/... server: common $(BINDIR) - GOPATH=$(GOPATH) $(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o $(BINDIR)/signaling ./server/... + $(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o $(BINDIR)/signaling ./server/... proxy: common $(BINDIR) - GOPATH=$(GOPATH) $(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o $(BINDIR)/proxy ./proxy/... + $(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o $(BINDIR)/proxy ./proxy/... clean: rm -f *_easyjson.go From b066785b00775199bea8928bff7547765dc55fea Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 5 Apr 2022 10:32:03 +0200 Subject: [PATCH 5/6] CI: Update cache paths. --- .github/workflows/lint.yml | 17 +++++++++++++++++ .github/workflows/test.yml | 18 +++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8e59ea9..df4457e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,6 +19,23 @@ jobs: continue-on-error: true steps: - uses: actions/checkout@v3 + - id: go-cache-paths + run: | + echo "::set-output name=go-build::$(go env GOCACHE)" + echo "::set-output name=go-mod::$(go env GOMODCACHE)" + echo "::set-output name=go-version::$(go version | cut -d ' ' -f 3)" + + - name: Go build cache + uses: actions/cache@v3 + with: + path: ${{ steps.go-cache-paths.outputs.go-build }} + key: ${{ runner.os }}-${{ steps.go-cache-paths.outputs.go-version }}-build-${{ hashFiles('**/go.mod', '**/go.sum') }} + + - name: Go mod cache + uses: actions/cache@v3 + with: + path: ${{ steps.go-cache-paths.outputs.go-mod }} + key: ${{ runner.os }}-${{ steps.go-cache-paths.outputs.go-version }}-mod-${{ hashFiles('**/go.mod', '**/go.sum') }} - name: Install dependencies run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d415afe..ba2800c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,11 +30,23 @@ jobs: with: go-version: ${{ matrix.go-version }} - - name: Cache dependencies + - id: go-cache-paths + run: | + echo "::set-output name=go-build::$(go env GOCACHE)" + echo "::set-output name=go-mod::$(go env GOMODCACHE)" + echo "::set-output name=go-version::$(go version | cut -d ' ' -f 3)" + + - name: Go build cache uses: actions/cache@v3 with: - path: vendor/ - key: vendor-${{ matrix.go-version }}-${{ hashFiles('go.mod', 'go.sum') }} + path: ${{ steps.go-cache-paths.outputs.go-build }} + key: ${{ runner.os }}-${{ steps.go-cache-paths.outputs.go-version }}-build-${{ hashFiles('**/go.mod', '**/go.sum') }} + + - name: Go mod cache + uses: actions/cache@v3 + with: + path: ${{ steps.go-cache-paths.outputs.go-mod }} + key: ${{ runner.os }}-${{ steps.go-cache-paths.outputs.go-version }}-mod-${{ hashFiles('**/go.mod', '**/go.sum') }} - name: Build applications run: | From 54715aa6d731a635a9aa1ee853536df492d44086 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 5 Apr 2022 10:49:12 +0200 Subject: [PATCH 6/6] lint: Install dependencies with Golang 1.17 --- .github/workflows/lint.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index df4457e..e739482 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,6 +19,10 @@ jobs: continue-on-error: true steps: - uses: actions/checkout@v3 + - uses: actions/setup-go@v2 + with: + go-version: "1.17" + - id: go-cache-paths run: | echo "::set-output name=go-build::$(go env GOCACHE)"