Skip to content

Commit

Permalink
Merge pull request #237 from moul/dev/moul/chiutil
Browse files Browse the repository at this point in the history
feat: make chiutil go-importable
  • Loading branch information
moul authored Feb 5, 2020
2 parents 7328188 + 0cf973b commit ba4612b
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 94 deletions.
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ GOBINS = ./cmd/depviz
#GOBINS += ./tools/sed-i-github-issues
DOCKER_IMAGE ?= moul/depviz


all: test install


PRE_INSTALL_STEPS += generate
PRE_TEST_STEPS += generate
PRE_BUILD_STEPS += generate
Expand Down Expand Up @@ -51,6 +47,7 @@ gen.sum: $(GEN_DEPS)
-xec 'make generate_local'; \
make tidy \
)
@rm -f gen.sum.tmp


PROTOC_OPTS = -I ./vendor/github.com/grpc-ecosystem/grpc-gateway:./api:./vendor:/protobuf
Expand All @@ -62,7 +59,7 @@ generate_local:
--gogofaster_out="plugins=grpc:$(GOPATH)/src" \
"$$proto" \
); done
goimportbs -w ./pkg ./cmd ./internal
goimports -w ./pkg ./cmd ./internal
shasum $(GEN_DEPS) | sort > gen.sum.tmp
mv gen.sum.tmp gen.sum

Expand Down
2 changes: 1 addition & 1 deletion gen.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 21 additions & 20 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 57 additions & 48 deletions go.sum

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion internal/chiutil/doc.go

This file was deleted.

2 changes: 1 addition & 1 deletion internal/dvserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
chilogger "github.com/treastech/logger"
"go.uber.org/zap"
"google.golang.org/grpc"
"moul.io/depviz/internal/chiutil"
"moul.io/depviz/internal/dvcore"
"moul.io/depviz/pkg/chiutil"
"moul.io/multipmuri"
)

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions pkg/chiutil/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package chiutil // import "moul.io/depviz/pkg/chiutil"
13 changes: 7 additions & 6 deletions rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ endif
ifdef GOPKG
GO ?= go
GOPATH ?= $(HOME)/go
GOLIBS ?= $(shell find . -type f -name "go.mod" | grep -v /vendor/ | sed 's@/[^/]*$$@@' | sort | uniq)
GO_INSTALL_OPTS ?=
GO_TEST_OPTS ?= -test.timeout=30s

Expand All @@ -93,7 +94,7 @@ go.unittest: coverage.txt
coverage.txt:
@rm -f /tmp/coverage.txt
@touch /tmp/coverage.txt
@set -e; for dir in `find . -type f -name "go.mod" | grep -v /vendor/ | sed 's@/[^/]*$$@@' | sort | uniq`; do ( set -xe; \
@set -e; for dir in $(GOLIBS); do ( set -xe; \
cd $$dir; \
$(GO) test $(GO_TEST_OPTS) -cover -coverprofile=/tmp/profile.out -covermode=atomic -race ./...; \
if [ -f /tmp/profile.out ]; then \
Expand All @@ -108,36 +109,36 @@ go.coverfunc: coverage.txt

.PHONY: go.lint
go.lint:
@set -e; for dir in `find . -type f -name "go.mod" | grep -v /vendor/ | sed 's@/[^/]*$$@@' | sort | uniq`; do ( set -xe; \
@set -e; for dir in $(GOLIBS); do ( set -xe; \
cd $$dir; \
golangci-lint run --verbose ./...; \
); done

.PHONY: go.tidy
go.tidy:
@set -e; for dir in `find . -type f -name "go.mod" | grep -v /vendor/ | sed 's@/[^/]*$$@@' | sort | uniq`; do ( set -xe; \
@set -e; for dir in $(GOLIBS); do ( set -xe; \
cd $$dir; \
$(GO) mod tidy; \
); done

.PHONY: go.build
go.build:
@set -e; for dir in `find . -type f -name "go.mod" | grep -v /vendor/ | sed 's@/[^/]*$$@@' | sort | uniq`; do ( set -xe; \
@set -e; for dir in $(GOLIBS); do ( set -xe; \
cd $$dir; \
$(GO) build ./...; \
); done

.PHONY: go.bump-deps
go.bumpdeps:
@set -e; for dir in `find . -type f -name "go.mod" | grep -v /vendor/ | sed 's@/[^/]*$$@@' | sort | uniq`; do ( set -xe; \
@set -e; for dir in $(GOLIBS); do ( set -xe; \
cd $$dir; \
$(GO) get -u ./...; \
); done

.PHONY: go.bump-deps
go.fmt:
if ! command -v goimports &>/dev/null; then GO111MODULE=off go get golang.org/x/tools/cmd/goimports; fi
@set -e; for dir in `find . -type f -name "go.mod" | grep -v /vendor/ | sed 's@/[^/]*$$@@' | sort | uniq`; do ( set -xe; \
@set -e; for dir in $(GOLIBS); do ( set -xe; \
cd $$dir; \
goimports -w . \
); done
Expand Down
8 changes: 4 additions & 4 deletions tool/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions tool/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ba4612b

Please sign in to comment.