Skip to content

Commit

Permalink
Mockery deprecation (cadence-workflow#2724)
Browse files Browse the repository at this point in the history
* Use goimports instead of gofmt for better imports management
* Deprecate domain cache mockery
  • Loading branch information
wxing1292 authored Oct 28, 2019
1 parent a1b996d commit 403373b
Show file tree
Hide file tree
Showing 96 changed files with 775 additions and 660 deletions.
39 changes: 21 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,27 @@ go-generate:
@echo "running go generate ./..."
@go generate ./...

bins_nothrift: go-generate lint copyright cadence-cassandra-tool cadence-sql-tool cadence cadence-server
lint:
@echo "running linter"
@lintFail=0; for file in $(ALL_SRC); do \
golint "$$file"; \
if [ $$? -eq 1 ]; then lintFail=1; fi; \
done; \
if [ $$lintFail -eq 1 ]; then exit 1; fi;
@OUTPUT=`gofmt -l $(ALL_SRC) 2>&1`; \
if [ "$$OUTPUT" ]; then \
echo "Run 'make fmt'. gofmt must be run on the following files:"; \
echo "$$OUTPUT"; \
exit 1; \
fi

fmt:
GO111MODULE=off go get -u github.com/myitcv/gobin
GOOS= GOARCH= gobin -mod=readonly golang.org/x/tools/cmd/goimports
@echo "running goimports"
@goimports -w $(ALL_SRC)

bins_nothrift: go-generate fmt lint copyright cadence-cassandra-tool cadence-sql-tool cadence cadence-server

bins: thriftc bins_nothrift

Expand Down Expand Up @@ -215,23 +235,6 @@ cover: $(COVER_ROOT)/cover.out
cover_ci: $(COVER_ROOT)/cover.out
goveralls -coverprofile=$(COVER_ROOT)/cover.out -service=buildkite || echo Coveralls failed;

lint:
@echo Running linter
@lintFail=0; for file in $(ALL_SRC); do \
golint "$$file"; \
if [ $$? -eq 1 ]; then lintFail=1; fi; \
done; \
if [ $$lintFail -eq 1 ]; then exit 1; fi;
@OUTPUT=`gofmt -l $(ALL_SRC) 2>&1`; \
if [ "$$OUTPUT" ]; then \
echo "Run 'make fmt'. gofmt must be run on the following files:"; \
echo "$$OUTPUT"; \
exit 1; \
fi

fmt:
@gofmt -w $(ALL_SRC)

clean:
rm -f cadence
rm -f cadence-sql-tool
Expand Down
1 change: 1 addition & 0 deletions client/admin/metricClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package admin

import (
"context"

"github.com/uber/cadence/.gen/go/admin"
"github.com/uber/cadence/.gen/go/shared"
"github.com/uber/cadence/common/metrics"
Expand Down
1 change: 1 addition & 0 deletions client/history/retryableClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package history

import (
"context"

h "github.com/uber/cadence/.gen/go/history"
"github.com/uber/cadence/.gen/go/replicator"
"github.com/uber/cadence/.gen/go/shared"
Expand Down
2 changes: 2 additions & 0 deletions cmd/server/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
// yarpc plugin for thriftrw code gen
_ "go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc"

// goimports
_ "golang.org/x/tools/cmd/goimports"
// mockgen for generating mocks
_ "github.com/golang/mock/mockgen"
)
3 changes: 2 additions & 1 deletion cmd/tools/cassandra/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
package main

import (
"github.com/uber/cadence/tools/cassandra"
"os"

"github.com/uber/cadence/tools/cassandra"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion cmd/tools/sql/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
package main

import (
"github.com/uber/cadence/tools/sql"
"os"

"github.com/uber/cadence/tools/sql"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion common/archiver/filestore/queryParser_mock.go

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

2 changes: 2 additions & 0 deletions common/cache/domainCache.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

//go:generate mockgen -copyright_file ../../LICENSE -package $GOPACKAGE -source $GOFILE -destination domainCache_mock.go -self_package github.com/uber/cadence/common/cache

package cache

import (
Expand Down
Loading

0 comments on commit 403373b

Please sign in to comment.