Skip to content
This repository was archived by the owner on Sep 18, 2020. It is now read-only.

Commit 019e9e4

Browse files
authored
Merge pull request #90 from AlexNPavel/makefix
build: fix version handling
2 parents fece07c + 53d9058 commit 019e9e4

3 files changed

Lines changed: 21 additions & 37 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export CGO_ENABLED:=0
22

3-
VERSION=$(shell ./git-version)
4-
LD_FLAGS="-w -X github.com/coreos/container-linux-config-transpiler/version.Raw=$(VERSION)"
3+
VERSION=$(shell git describe --dirty)
4+
LD_FLAGS="-w -X github.com/coreos/container-linux-config-transpiler/internal/version.Raw=$(VERSION)"
55

66
REPO=github.com/coreos/container-linux-config-transpiler
77

build

Lines changed: 0 additions & 21 deletions
This file was deleted.

test

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,39 @@
22

33
set -eu
44

5-
source ./build
5+
ORG_PATH="github.com/coreos"
6+
REPO_PATH="${ORG_PATH}/container-linux-config-transpiler"
7+
8+
if [ ! -h gopath/src/${REPO_PATH} ]; then
9+
mkdir -p gopath/src/${ORG_PATH}
10+
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
11+
fi
12+
13+
export GOPATH=${PWD}/gopath
614

715
SRC=$(find . -name '*.go' \
816
-not -path "./vendor/*")
917

10-
PKG=$(cd gopath/src/${REPO_PATH}; go list ./... | \
11-
grep --invert-match vendor)
12-
13-
# https://github.com/golang/go/issues/15067
14-
PKG_VET=$(cd gopath/src/${REPO_PATH}; go list ./... | \
15-
grep --invert-match vendor | \
16-
grep --invert-match internal/log)
18+
PKGS=$(cd gopath/src/${REPO_PATH}; go list ./... | \
19+
grep --invert-match /vendor)
20+
FORMATTABLE=$(cd gopath/src/${REPO_PATH}; ls -d */ | \
21+
grep --invert-match --extended-regexp '(vendor/)')
1722

1823
echo "Checking gofix..."
1924
go tool fix -diff $SRC
2025

2126
echo "Checking gofmt..."
22-
res=$(gofmt -d -e -s $SRC)
23-
echo "${res}"
24-
if [ -n "${res}" ]; then
25-
exit 1
27+
fmtRes=$(gofmt -l $FORMATTABLE)
28+
if [ -n "${fmtRes}" ]; then
29+
echo -e "gofmt checking failed:\n${fmtRes}"
30+
exit 2
2631
fi
2732

2833
echo "Checking govet..."
29-
go vet $PKG_VET
34+
go vet $PKGS
3035

3136
echo "Running tests..."
32-
go test -timeout 60s -cover $@ ${PKG}
37+
go test $PKGS -cover
3338

3439
echo "Checking documentation..."
3540
go run internal/util/tools/docs.go

0 commit comments

Comments
 (0)