Better Makefiles

This commit is contained in:
Tamir Duberstein 2015-05-11 19:31:38 -04:00
parent dada32c78b
commit 4fc85e2b3c
6 changed files with 38 additions and 42 deletions

View File

@ -1,32 +1,2 @@
all: regen check all:
make -C testdata
regen:
go install ./...
make -C testdata regen
.PHONY: check
check: errcheck go-nyet golint
errcheck testdata/out/compress-memcopy.go
errcheck testdata/out/compress-nomemcopy.go
errcheck testdata/out/debug.go
errcheck testdata/out/nocompress-memcopy.go
errcheck testdata/out/nocompress-nomemcopy.go
go-nyet testdata/out/compress-memcopy.go
go-nyet testdata/out/compress-nomemcopy.go
go-nyet testdata/out/debug.go
go-nyet testdata/out/nocompress-memcopy.go
go-nyet testdata/out/nocompress-nomemcopy.go
golint testdata/out/compress-memcopy.go
golint testdata/out/compress-nomemcopy.go
golint testdata/out/debug.go
golint testdata/out/nocompress-memcopy.go
golint testdata/out/nocompress-nomemcopy.go
errcheck:
go get github.com/kisielk/errcheck
go-nyet:
go get github.com/barakmich/go-nyet
golint:
go get github.com/golang/lint/golint

38
testdata/Makefile vendored
View File

@ -1,6 +1,32 @@
regen: .PHONY: check
go-bindata -o out/compress-memcopy.go in/... check: out/compress-memcopy.go out/compress-nomemcopy.go out/debug.go out/nocompress-memcopy.go out/nocompress-nomemcopy.go errcheck go-nyet golint
go-bindata -nomemcopy -o out/compress-nomemcopy.go in/... $(foreach file, $(wildcard out/*.go), errcheck $(file);)
go-bindata -debug -o out/debug.go in/... $(foreach file, $(wildcard out/*.go), go-nyet $(file);)
go-bindata -nocompress -o out/nocompress-memcopy.go in/... $(foreach file, $(wildcard out/*.go), golint $(file);)
go-bindata -nocompress -nomemcopy -o out/nocompress-nomemcopy.go in/...
$(GOPATH)/bin/go-bindata: $(wildcard ../*.go) $(wildcard ../**/*.go)
go install ../...
out/compress-memcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
$(GOPATH)/bin/go-bindata -o $@ in/...
out/compress-nomemcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
$(GOPATH)/bin/go-bindata -nomemcopy -o $@ in/...
out/debug.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
$(GOPATH)/bin/go-bindata -debug -o $@ in/...
out/nocompress-memcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
$(GOPATH)/bin/go-bindata -nocompress -o $@ in/...
out/nocompress-nomemcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
$(GOPATH)/bin/go-bindata -nocompress -nomemcopy -o $@ in/...
errcheck:
go get github.com/kisielk/errcheck
go-nyet:
go get github.com/barakmich/go-nyet
golint:
go get github.com/golang/lint/golint

View File

@ -79,7 +79,7 @@ func in_a_test_asset() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)} info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1431385279, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }

View File

@ -89,7 +89,7 @@ func in_a_test_asset() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)} info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1431385279, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }

View File

@ -53,7 +53,7 @@ func in_a_test_asset() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)} info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1431385279, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }

View File

@ -69,7 +69,7 @@ func in_a_test_asset() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)} info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1431385279, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }