File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- .PHONY : all setup build lint test install
1+ .PHONY : all setup build run lint test
22
33VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null | sed 's/^v//')
44COMMIT ?= $(shell git rev-parse --short=12 HEAD 2>/dev/null || echo "unknown")
@@ -15,13 +15,11 @@ all: lint test build
1515setup : bin/golangci-lint
1616 go mod download
1717
18- dune-cli : lint
18+ build : lint
1919 go build -ldflags ' $(LDFLAGS)' -o dune-cli ./cmd
2020
21- build : dune-cli
22-
23- install :
24- go build -ldflags ' $(LDFLAGS)' -o $(shell go env GOPATH) /bin/dune ./cmd
21+ run :
22+ go run -ldflags ' $(LDFLAGS)' ./cmd $(ARGS )
2523
2624bin :
2725 mkdir -p bin
Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ func New(cfg Config) *Tracker {
3939 ampConfig .ServerZone = "EU"
4040 ampConfig .FlushQueueSize = 1
4141 ampConfig .FlushInterval = 1 * time .Second
42+ if ! isDevVersion (cfg .CLIVersion ) {
43+ ampConfig .Logger = silentLogger {}
44+ }
4245
4346 return & Tracker {
4447 client : amplitude .NewClient (ampConfig ),
@@ -76,6 +79,19 @@ func (t *Tracker) Shutdown() {
7679 }
7780}
7881
82+ // isDevVersion returns true for local / non-release builds.
83+ func isDevVersion (v string ) bool {
84+ return v == "" || v == "dev"
85+ }
86+
87+ // silentLogger suppresses all amplitude SDK log output.
88+ type silentLogger struct {}
89+
90+ func (silentLogger ) Debugf (string , ... interface {}) {}
91+ func (silentLogger ) Infof (string , ... interface {}) {}
92+ func (silentLogger ) Warnf (string , ... interface {}) {}
93+ func (silentLogger ) Errorf (string , ... interface {}) {}
94+
7995const (
8096 anonIDFile = "anonymous_id"
8197 anonFallback = "anonymous"
You can’t perform that action at this time.
0 commit comments