Skip to content

Commit

Permalink
Updated Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
hexdigest committed Jun 21, 2021
1 parent 7e0b6d3 commit 12ee5be
Show file tree
Hide file tree
Showing 8 changed files with 1,451 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ _testmain.go
/cmd/minimock/minimock
/minimock
/dist
/bin
9 changes: 2 additions & 7 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,15 @@ builds:
binary: minimock
env:
- CGO_ENABLED=0
- GO386=softfloat
goos:
- darwin
- linux
- windows

ldflags:
- -X main.version={{.Version}} -X main.commit={{.FullCommit}} -X main.buildDate={{.Date}}
archive:
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64

checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ install:
- go get github.com/mattn/goveralls
- if ! go get github.com/golang/tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
- export BINDIR=./bin
- curl -L https://git.io/vp6lP | sh #gometalinter installation
- export PATH=`pwd`/bin:$PATH
- export GO111MODULE=on

Expand Down
27 changes: 25 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
export GOBIN := $(PWD)/bin
export PATH := $(GOBIN):$(PATH)
export GOFLAGS := -mod=mod

all: install test lint clean

generate:
go run ./cmd/minimock/minimock.go -i github.com/gojuno/minimock/v3.Tester -o ./tests
go run ./cmd/minimock/minimock.go -i ./tests.Formatter -o ./tests/formatter_mock.go

lint:
gometalinter ./tests/ -I minimock -e gopathwalk --disable=gotype --deadline=2m
#lint:
# gometalinter ./tests/ -I minimock -e gopathwalk --disable=gotype --deadline=2m
#

./bin:
mkdir ./bin

./bin/golangci-lint: ./bin
go get github.com/golangci/golangci-lint/cmd/golangci-lint

./bin/goreleaser:
go install github.com/goreleaser/goreleaser

lint: ./bin/golangci-lint
./bin/golangci-lint run --enable=goimports --disable=unused --exclude=S1023,"Error return value" ./tests/...

install:
go mod download
Expand All @@ -24,3 +41,9 @@ test: test_save_origin generate
diff ./tests/formatter_mock.go ./tests/formatter_mock.go.test_origin
diff ./tests/tester_mock_test.go ./tests/tester_mock_test.go.test_origin
go test -race ./...

release: ./bin/goreleaser
goreleaser release

build: ./bin/goreleaser
goreleaser build --snapshot --rm-dist
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ module github.com/gojuno/minimock/v3

require (
github.com/davecgh/go-spew v1.1.1
github.com/golangci/golangci-lint v1.41.1 // indirect
github.com/goreleaser/goreleaser v0.171.0 // indirect
github.com/hexdigest/gowrap v1.1.8
github.com/pkg/errors v0.8.0
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.0
github.com/stretchr/testify v1.3.0
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59
github.com/stretchr/testify v1.7.0
golang.org/x/tools v0.1.3
)

go 1.13
1,407 changes: 1,407 additions & 0 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/formatter_with_custom_name_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,4 +322,4 @@ func TestCustomFormatterNameMock_CallsReturnsCopy(t *testing.T) {
for i, c := range callHistory {
assert.Equal(t, i+1, len(c))
}
}
}
10 changes: 10 additions & 0 deletions tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// +build tools

package minimock

// https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md
import (
_ "github.com/gojuno/minimock/v3/cmd/minimock"
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
_ "github.com/goreleaser/goreleaser"
)

0 comments on commit 12ee5be

Please sign in to comment.