Skip to content

Commit

Permalink
use GOBIN instead of GOPATH/bin
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <kpango@vdaas.org>
  • Loading branch information
kpango committed Jul 11, 2023
1 parent 5f79f6e commit 2c709db
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/chatops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ jobs:
id: format_push
if: steps.check_comments_format.outputs.BOOL_TRIGGERED == 'true' && steps.check_permissions.outputs.EXECUTABLE == 'true'
run: |
export PATH=$(go env GOPATH)/bin:$PATH
export PATH=$(go env GOBIN):$PATH
curl -s ${PR_INFO_URL} > /tmp/pr_info.json
PR_RESP=`cat /tmp/pr_info.json`
Expand Down
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ NGT_VERSION := $(eval NGT_VERSION := $(shell cat versions/NGT_VERSION))$(NGT_VER
NGT_REPO = github.com/yahoojapan/NGT

GOPROXY=direct
GOPATH := $(eval GOPATH := $(shell go env GOPATH))$(GOPATH)
GO_VERSION := $(eval GO_VERSION := $(shell cat versions/GO_VERSION))$(GO_VERSION)
GOARCH := $(eval GOARCH := $(shell go env GOARCH))$(GOARCH)
GOBIN := $(eval GOBIN := $(shell go env GOBIN))$(GOBIN)
GOBIN := $(eval GOBIN := $(or $(shell go env GOBIN),$(GOPATH)/bin))$(GOBIN)
GOCACHE := $(eval GOCACHE := $(shell go env GOCACHE))$(GOCACHE)
GOOS := $(eval GOOS := $(shell go env GOOS))$(GOOS)
GOPATH := $(eval GOPATH := $(shell go env GOPATH))$(GOPATH)
GOTEST_TIMEOUT = 30m
TEST_NOT_IMPL_PLACEHOLDER = NOT IMPLEMENTED BELOW

Expand Down Expand Up @@ -407,10 +407,10 @@ format/go: \
gofumpt/install \
strictgoimports/install \
goimports/install
find ./ -type d -name .git -prune -o -type f -regex '.*[^\.pb]\.go' -print | xargs $(GOPATH)/bin/golines -w -m $(GOLINES_MAX_WIDTH)
find ./ -type d -name .git -prune -o -type f -regex '.*[^\.pb]\.go' -print | xargs $(GOPATH)/bin/gofumpt -w
find ./ -type d -name .git -prune -o -type f -regex '.*[^\.pb]\.go' -print | xargs $(GOPATH)/bin/strictgoimports -w
find ./ -type d -name .git -prune -o -type f -regex '.*\.go' -print | xargs $(GOPATH)/bin/goimports -w
find ./ -type d -name .git -prune -o -type f -regex '.*[^\.pb]\.go' -print | xargs $(GOBIN)/golines -w -m $(GOLINES_MAX_WIDTH)
find ./ -type d -name .git -prune -o -type f -regex '.*[^\.pb]\.go' -print | xargs $(GOBIN)/gofumpt -w
find ./ -type d -name .git -prune -o -type f -regex '.*[^\.pb]\.go' -print | xargs $(GOBIN)/strictgoimports -w
find ./ -type d -name .git -prune -o -type f -regex '.*\.go' -print | xargs $(GOBIN)/goimports -w

.PHONY: format/go/test
## run golines, gofumpt, goimports for go test files
Expand All @@ -419,10 +419,10 @@ format/go/test: \
gofumpt/install \
strictgoimports/install \
goimports/install
find $(ROOTDIR)/* -name '*_test.go' | xargs $(GOPATH)/bin/golines -w -m $(GOLINES_MAX_WIDTH)
find $(ROOTDIR)/* -name '*_test.go' | xargs $(GOPATH)/bin/gofumpt -w
find $(ROOTDIR)/* -name '*_test.go' | xargs $(GOPATH)/bin/strictgoimports -w
find $(ROOTDIR)/* -name '*_test.go' | xargs $(GOPATH)/bin/goimports -w
find $(ROOTDIR)/* -name '*_test.go' | xargs $(GOBIN)/golines -w -m $(GOLINES_MAX_WIDTH)
find $(ROOTDIR)/* -name '*_test.go' | xargs $(GOBIN)/gofumpt -w
find $(ROOTDIR)/* -name '*_test.go' | xargs $(GOBIN)/strictgoimports -w
find $(ROOTDIR)/* -name '*_test.go' | xargs $(GOBIN)/goimports -w

.PHONY: format/yaml
format/yaml: \
Expand Down
4 changes: 2 additions & 2 deletions Makefile.d/functions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ endef
define proto-code-gen
protoc \
$(PROTO_PATHS:%=-I %) \
--go_out=$(GOPATH)/src --plugin protoc-gen-go="$(GOPATH)/bin/protoc-gen-go" \
--go-vtproto_out=$(GOPATH)/src --plugin protoc-gen-go-vtproto="$(GOPATH)/bin/protoc-gen-go-vtproto" \
--go_out=$(GOPATH)/src --plugin protoc-gen-go="$(GOBIN)/protoc-gen-go" \
--go-vtproto_out=$(GOPATH)/src --plugin protoc-gen-go-vtproto="$(GOBIN)/protoc-gen-go-vtproto" \
--go-vtproto_opt=features=grpc+marshal+unmarshal+size+equal+clone \
$1
endef
Expand Down
38 changes: 19 additions & 19 deletions Makefile.d/proto.mk
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ proto/paths/print:
.PHONY: proto/deps
## install protobuf dependencies
proto/deps: \
$(GOPATH)/bin/protoc-gen-doc \
$(GOPATH)/bin/protoc-gen-go \
$(GOPATH)/bin/protoc-gen-go-grpc \
$(GOPATH)/bin/protoc-gen-go-vtproto \
$(GOPATH)/bin/protoc-gen-grpc-gateway \
$(GOPATH)/bin/protoc-gen-swagger \
$(GOPATH)/bin/protoc-gen-validate \
$(GOPATH)/bin/prototool \
$(GOPATH)/bin/swagger \
$(GOBIN)/protoc-gen-doc \
$(GOBIN)/protoc-gen-go \
$(GOBIN)/protoc-gen-go-grpc \
$(GOBIN)/protoc-gen-go-vtproto \
$(GOBIN)/protoc-gen-grpc-gateway \
$(GOBIN)/protoc-gen-swagger \
$(GOBIN)/protoc-gen-validate \
$(GOBIN)/prototool \
$(GOBIN)/swagger \
$(GOPATH)/src/github.com/envoyproxy/protoc-gen-validate \
$(GOPATH)/src/github.com/golang/protobuf \
$(GOPATH)/src/github.com/googleapis/googleapis \
Expand Down Expand Up @@ -102,31 +102,31 @@ $(GOPATH)/src/google.golang.org/genproto:
https://github.com/googleapis/go-genproto \
$(GOPATH)/src/google.golang.org/genproto

$(GOPATH)/bin/protoc-gen-go:
$(GOBIN)/protoc-gen-go:
$(call go-install, google.golang.org/protobuf/cmd/protoc-gen-go)

$(GOPATH)/bin/protoc-gen-go-grpc:
$(GOBIN)/protoc-gen-go-grpc:
$(call go-install, google.golang.org/grpc/cmd/protoc-gen-go-grpc)

$(GOPATH)/bin/protoc-gen-grpc-gateway:
$(GOBIN)/protoc-gen-grpc-gateway:
$(call go-install, github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway)

$(GOPATH)/bin/protoc-gen-swagger:
$(GOBIN)/protoc-gen-swagger:
$(call go-install, github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger)

$(GOPATH)/bin/protoc-gen-validate:
$(GOBIN)/protoc-gen-validate:
$(call go-install, github.com/envoyproxy/protoc-gen-validate)

$(GOPATH)/bin/prototool:
$(GOBIN)/prototool:
$(call go-install, github.com/uber/prototool/cmd/prototool)

$(GOPATH)/bin/protoc-gen-doc:
$(GOBIN)/protoc-gen-doc:
$(call go-install, github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc)

$(GOPATH)/bin/protoc-gen-go-vtproto:
$(GOBIN)/protoc-gen-go-vtproto:
$(call go-install, github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto)

$(GOPATH)/bin/swagger:
$(GOBIN)/swagger:
$(call go-install, github.com/go-swagger/go-swagger/cmd/swagger)

$(PBGOS): \
Expand All @@ -153,4 +153,4 @@ $(PBDOCS): \
apis/docs/v1/docs.md: $(PROTOS_V1)
@$(call green, "generating documents for API v1...")
$(call mkdir, $(dir $@))
$(call protoc-gen, $(PROTOS_V1), --plugin=protoc-gen-doc=$(GOPATH)/bin/protoc-gen-doc --doc_opt=markdown$(COMMA)docs.md --doc_out=$(dir $@))
$(call protoc-gen, $(PROTOS_V1), --plugin=protoc-gen-doc=$(GOBIN)/protoc-gen-doc --doc_opt=markdown$(COMMA)docs.md --doc_out=$(dir $@))
16 changes: 8 additions & 8 deletions Makefile.d/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@ $(BINDIR)/golangci-lint:
| sh -s -- -b $(BINDIR) $(GOLANGCILINT_VERSION)

.PHONY: goimports/install
goimports/install: $(GOPATH)/bin/goimports
goimports/install: $(GOBIN)/goimports

$(GOPATH)/bin/goimports:
$(GOBIN)/goimports:
$(call go-install, golang.org/x/tools/cmd/goimports)

.PHONY: strictgoimports/install
strictgoimports/install: $(GOPATH)/bin/strictgoimports
strictgoimports/install: $(GOBIN)/strictgoimports

$(GOPATH)/bin/strictgoimports:
$(GOBIN)/strictgoimports:
$(call go-install, github.com/momotaro98/strictgoimports/cmd/strictgoimports)

.PHONY: gofumpt/install
gofumpt/install: $(GOPATH)/bin/gofumpt
gofumpt/install: $(GOBIN)/gofumpt

$(GOPATH)/bin/gofumpt:
$(GOBIN)/gofumpt:
$(call go-install, mvdan.cc/gofumpt)

.PHONY: golines/install
golines/install: $(GOPATH)/bin/golines
golines/install: $(GOBIN)/golines

$(GOPATH)/bin/golines:
$(GOBIN)/golines:
$(call go-install, github.com/segmentio/golines)

.PHONY: prettier/install
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ replace (
go.uber.org/zap => go.uber.org/zap v1.24.0
gocloud.dev => gocloud.dev v0.30.0
golang.org/x/crypto => golang.org/x/crypto v0.11.0
golang.org/x/exp => golang.org/x/exp v0.0.0-20230711023510-fffb14384f22
golang.org/x/exp/typeparams => golang.org/x/exp/typeparams v0.0.0-20230711023510-fffb14384f22
golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb
golang.org/x/exp/typeparams => golang.org/x/exp/typeparams v0.0.0-20230711153332-06a737ee72cb
golang.org/x/image => golang.org/x/image v0.9.0
golang.org/x/lint => golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
golang.org/x/mobile => golang.org/x/mobile v0.0.0-20230531173138-3c911d8e3eda
Expand All @@ -312,9 +312,9 @@ replace (
gonum.org/v1/plot => gonum.org/v1/plot v0.13.0
google.golang.org/api => google.golang.org/api v0.130.0
google.golang.org/appengine => google.golang.org/appengine v1.6.7
google.golang.org/genproto => google.golang.org/genproto v0.0.0-20230710151506-e685fd7b542b
google.golang.org/genproto/googleapis/api => google.golang.org/genproto/googleapis/api v0.0.0-20230710151506-e685fd7b542b
google.golang.org/genproto/googleapis/rpc => google.golang.org/genproto/googleapis/rpc v0.0.0-20230710151506-e685fd7b542b
google.golang.org/genproto => google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98
google.golang.org/genproto/googleapis/api => google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98
google.golang.org/genproto/googleapis/rpc => google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98
google.golang.org/grpc => google.golang.org/grpc v1.56.2
google.golang.org/grpc/cmd/protoc-gen-go-grpc => google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
google.golang.org/protobuf => google.golang.org/protobuf v1.31.0
Expand Down Expand Up @@ -362,7 +362,7 @@ require (
github.com/klauspost/compress v1.15.9
github.com/kpango/fastime v1.1.9
github.com/kpango/fuid v0.0.0-00010101000000-000000000000
github.com/kpango/gache/v2 v2.0.9
github.com/kpango/gache/v2 v2.0.0-00010101000000-000000000000
github.com/kpango/glg v1.6.15
github.com/leanovate/gopter v0.0.0-00010101000000-000000000000
github.com/lucasb-eyer/go-colorful v0.0.0-00010101000000-000000000000
Expand Down Expand Up @@ -457,7 +457,7 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
Expand Down
21 changes: 10 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ cloud.google.com/go/eventarc v1.12.1/go.mod h1:mAFCW6lukH5+IZjkvrEss+jmt2kOdYlN8
cloud.google.com/go/filestore v1.7.1/go.mod h1:y10jsorq40JJnjR/lQ8AfFbbcGlw3g+Dp8oN7i7FjV4=
cloud.google.com/go/firestore v1.11.0/go.mod h1:b38dKhgzlmNNGTNZZwe7ZRFEuRab1Hay3/DBsIGKKy4=
cloud.google.com/go/functions v1.15.1/go.mod h1:P5yNWUTkyU+LvW/S9O6V+V423VZooALQlqoXdoPz5AE=
cloud.google.com/go/gaming v1.10.1/go.mod h1:XQQvtfP8Rb9Rxnxm5wFVpAp9zCQkJi2bLIb7iHGwB3s=
cloud.google.com/go/gkebackup v0.4.0/go.mod h1:byAyBGUwYGEEww7xsbnUTBHIYcOPy/PgUWUtOeRm9Vg=
cloud.google.com/go/gkeconnect v0.8.1/go.mod h1:KWiK1g9sDLZqhxB2xEuPV8V9NYzrqTUmQR9shJHpOZw=
cloud.google.com/go/gkehub v0.14.1/go.mod h1:VEXKIJZ2avzrbd7u+zeMtW00Y8ddk/4V9511C9CQGTY=
Expand Down Expand Up @@ -697,12 +696,12 @@ golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUu
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/exp v0.0.0-20230711023510-fffb14384f22 h1:FqrVOBQxQ8r/UwwXibI0KMolVhvFiGobSfdE33deHJM=
golang.org/x/exp v0.0.0-20230711023510-fffb14384f22/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us=
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/exp/shiny v0.0.0-20220827204233-334a2380cb91/go.mod h1:VjAR7z0ngyATZTELrBSkxOOHhhlnVUxDye4mcjx5h/8=
golang.org/x/exp/shiny v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:UH99kUObWAZkDnWqppdQe5ZhPYESUw8I0zVV1uWBR+0=
golang.org/x/exp/typeparams v0.0.0-20230711023510-fffb14384f22 h1:e8iSCQYXZ4EB6q3kIfy2fgPFTvDbozqzRe4OuIOyrL4=
golang.org/x/exp/typeparams v0.0.0-20230711023510-fffb14384f22/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
golang.org/x/exp/typeparams v0.0.0-20230711153332-06a737ee72cb h1:dEBryXnHo5BYK4z4ZHvcaRKoNr3eyiNLW8+pcobHcng=
golang.org/x/exp/typeparams v0.0.0-20230711153332-06a737ee72cb/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
golang.org/x/image v0.9.0 h1:QrzfX26snvCM20hIhBwuHI/ThTg18b/+kcKdXHvnR+g=
golang.org/x/image v0.9.0/go.mod h1:jtrku+n79PfroUbvDdeUWMAI+heR786BofxrbiSF+J0=
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
Expand Down Expand Up @@ -739,13 +738,13 @@ google.golang.org/api v0.130.0 h1:A50ujooa1h9iizvfzA4rrJr2B7uRmWexwbekQ2+5FPQ=
google.golang.org/api v0.130.0/go.mod h1:J/LCJMYSDFvAVREGCbrESb53n4++NMBDetSHGL5I5RY=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20230710151506-e685fd7b542b h1:VCRiEG1fCSUI/+vnvyFY2zSxo5BZ2FcYENNR8afEQr0=
google.golang.org/genproto v0.0.0-20230710151506-e685fd7b542b/go.mod h1:NV95I5n2G0tFsBwqd9ZJ5tKNnNJgwCkz61wEZsHTB/c=
google.golang.org/genproto/googleapis/api v0.0.0-20230710151506-e685fd7b542b h1:3TOJqtuBSNLfLXJ2rZrzKFPz/WqgEjXaEYy/mZ8/j1k=
google.golang.org/genproto/googleapis/api v0.0.0-20230710151506-e685fd7b542b/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ=
google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g=
google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98/go.mod h1:S7mY02OqCJTD0E1OiQy1F72PWFB4bZJ87cAtLPYgDR0=
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw=
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ=
google.golang.org/genproto/googleapis/bytestream v0.0.0-20230629202037-9506855d4529/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230710151506-e685fd7b542b h1:BC7Q0uXfp6VFXnNWp5RqATIN/viqCGkqBO8+HxzH/jY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230710151506-e685fd7b542b/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM=
google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI=
google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y=
Expand Down
13 changes: 13 additions & 0 deletions internal/sync/map.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
// Copyright (C) 2019-2023 vdaas.org vald team <vald@vdaas.org>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// 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.
package sync

import gache "github.com/kpango/gache/v2"
Expand Down
2 changes: 1 addition & 1 deletion versions/PROMETHEUS_STACK_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
47.5.0
47.6.1

0 comments on commit 2c709db

Please sign in to comment.