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

Add vald standard internal/sync package #2153

Merged
merged 1 commit into from
Aug 31, 2023
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ linters:
- path: internal/test/comparator/standard\.go
linters:
- depguard
- path: internal/sync/alias\.go
linters:
- depguard
- path: hack/benchmark/src/singleflight/singleflight_bench_test\.go
linters:
- depguard
linters-settings:
gocritic:
enabled-checks:
Expand All @@ -169,6 +175,14 @@ linters-settings:
rules:
main:
deny:
- pkg: "sync"
desc: "sync is allowed only by internal/sync"
- pkg: "golang.org/x/sync"
desc: "golang.org/x/sync is allowed only by internal/sync"
- pkg: "golang.org/x/sync/singleflight"
desc: "golang.org/x/sync/singleflight is allowed only by internal/sync/singleflight"
- pkg: "golang.org/x/sync/semaphore"
desc: "golang.org/x/sync/semaphore is allowed only by internal/sync/semaphore"
- pkg: "errors"
desc: "errors is allowed only by internal/errors"
- pkg: "k8s.io/apimachinery/pkg/api/errors"
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4750,7 +4750,7 @@
- :white_check_mark: add internal/config/ngt test ([#554](https://github.com/vdaas/vald/pull/554))
- :white_check_mark: internal/cache/cacher test ([#553](https://github.com/vdaas/vald/pull/553))
- :white_check_mark: Add test case for `internal/file` ([#550](https://github.com/vdaas/vald/pull/550))
- :white_check_mark: add internal/singleflight test ([#542](https://github.com/vdaas/vald/pull/542))
- :white_check_mark: add internal/sync/singleflight test ([#542](https://github.com/vdaas/vald/pull/542))
- not to force rebuild gotests ([#548](https://github.com/vdaas/vald/pull/548))
- :pencil: Add use case document ([#482](https://github.com/vdaas/vald/pull/482))
- :white_check_mark: add internal/log/mock/retry test ([#549](https://github.com/vdaas/vald/pull/549))
Expand Down Expand Up @@ -5272,7 +5272,7 @@
- internal gRPC client for Vald
- Cassandra NewConvictionPolicy
- dicoverer now returns clone object
- new internal/singleflight package
- new internal/sync/singleflight package
- new internal/net package
- coding guideline

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
ORG ?= vdaas
NAME = vald
GOPKG = github.com/$(ORG)/$(NAME)
GOPRIVATE = $(GOPKG),$(GOPKG)/apis,$(GOPKG)-client-go
DATETIME = $(eval DATETIME := $(shell date -u +%Y/%m/%d_%H:%M:%S%z))$(DATETIME)
TAG ?= latest
CRORG ?= $(ORG)
Expand All @@ -39,7 +38,8 @@ VERSION ?= $(eval VERSION := $(shell cat versions/VALD_VERSION))$(VERSION)
NGT_VERSION := $(eval NGT_VERSION := $(shell cat versions/NGT_VERSION))$(NGT_VERSION)
NGT_REPO = github.com/yahoojapan/NGT

GOPROXY=direct
GOPRIVATE = $(GOPKG),$(GOPKG)/apis,$(GOPKG)-client-go
GOPROXY = "https://proxy.golang.org,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)
Expand Down Expand Up @@ -361,7 +361,7 @@ clean:
license:
GOPRIVATE=$(GOPRIVATE) \
MAINTAINER=$(MAINTAINER) \
go run -mod=readonly hack/license/gen/main.go ./
go run -mod=readonly hack/license/gen/main.go $(ROOTDIR)

.PHONY: init
## initialize development environment
Expand Down
2 changes: 1 addition & 1 deletion Makefile.d/dependencies.mk
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ update/chaos-mesh:
.PHONY: update/go
## update go version
update/go:
curl --silent https://go.dev/VERSION?m=text | sed -e 's/go//g' > $(ROOTDIR)/versions/GO_VERSION
curl --silent https://go.dev/VERSION?m=text | head -n 1 | sed -e 's/go//g' > $(ROOTDIR)/versions/GO_VERSION

.PHONY: update/golangci-lint
## update golangci-lint version
Expand Down
1 change: 1 addition & 0 deletions Makefile.d/proto.mk
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ $(PBGOS): \
find $(ROOTDIR)/apis/grpc/* -name '*.go' | xargs sed -i -E "s%google.golang.org/grpc/codes%github.com/vdaas/vald/internal/net/grpc/codes%g"
find $(ROOTDIR)/apis/grpc/* -name '*.go' | xargs sed -i -E "s%google.golang.org/grpc/status%github.com/vdaas/vald/internal/net/grpc/status%g"
find $(ROOTDIR)/apis/grpc/* -name '*.go' | xargs sed -i -E "s%\"io\"%\"github.com/vdaas/vald/internal/io\"%g"
find $(ROOTDIR)/apis/grpc/* -name '*.go' | xargs sed -i -E "s%\"sync\"%\"github.com/vdaas/vald/internal/sync\"%g"

$(SWAGGERS): \
$(PROTOS) \
Expand Down
2 changes: 1 addition & 1 deletion Makefile.d/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ gotests/patch:
@$(call green, "apply patches to go test files...")
find $(ROOTDIR)/internal/k8s/* -name '*_test.go' | xargs sed -i -E "s%k8s.io/apimachinery/pkg/api/errors%github.com/vdaas/vald/internal/errors%g"
find $(ROOTDIR)/* -name '*_test.go' | xargs sed -i -E "s%cockroachdb/errors%vdaas/vald/internal/errors%g"
find $(ROOTDIR)/* -name '*_test.go' | xargs sed -i -E "s%golang.org/x/sync/errgroup%github.com/vdaas/vald/internal/errgroup%g"
find $(ROOTDIR)/* -name '*_test.go' | xargs sed -i -E "s%golang.org/x/sync/errgroup%github.com/vdaas/vald/internal/sync/errgroup%g"
find $(ROOTDIR)/* -name '*_test.go' | xargs sed -i -E "s%pkg/errors%vdaas/vald/internal/errors%g"
find $(ROOTDIR)/* -name '*_test.go' | xargs sed -i -E "s%go-errors/errors%vdaas/vald/internal/errors%g"
find $(ROOTDIR)/* -name '*_test.go' | xargs sed -i -E "s%go.uber.org/goleak%github.com/vdaas/vald/internal/test/goleak%g"
Expand Down
Loading