Skip to content

Commit c8c6d8a

Browse files
authored
Add install to makefile (#11)
1 parent e2a5828 commit c8c6d8a

2 files changed

Lines changed: 20 additions & 12 deletions

File tree

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ endif
4646
.PHONY: ci
4747
ci: install-tools test coverage
4848

49+
.PHONY: install
50+
install:
51+
GO111MODULE=on go install \
52+
-trimpath \
53+
-ldflags \
54+
"-X github.com/onflow/flow-cli/build.commit=$(COMMIT) -X github.com/onflow/flow-cli/build.semver=$(VERSION)" \
55+
./cmd/flow
56+
4957
$(BINARY):
5058
GO111MODULE=on go build \
5159
-trimpath \

build/build.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,33 @@ const undefined = "undefined"
2929

3030
// The following variables are injected at build-time using ldflags.
3131
var (
32-
semver string
33-
commit string
32+
semver string
33+
commit string
3434
)
3535

3636
// Semver returns the semantic version of this build.
3737
func Semver() string {
38-
return semver
38+
return semver
3939
}
4040

4141
// Commit returns the commit at which this build was created.
4242
func Commit() string {
43-
return commit
43+
return commit
4444
}
4545

4646
// IsDefined determines whether a version string is defined. Inputs should
4747
// have been produced from this package.
4848
func IsDefined(v string) bool {
49-
return v != undefined
49+
return v != undefined
5050
}
5151

5252
// If any of the build-time-injected variables are empty at initialization,
5353
// mark them as undefined.
5454
func init() {
55-
if len(semver) == 0 {
56-
semver = undefined
57-
}
58-
if len(commit) == 0 {
59-
semver = undefined
60-
}
61-
}
55+
if len(semver) == 0 {
56+
semver = undefined
57+
}
58+
if len(commit) == 0 {
59+
commit = undefined
60+
}
61+
}

0 commit comments

Comments
 (0)