Skip to content

Commit 59e314b

Browse files
committed
prepare for homebrew formula build
1 parent 2bab106 commit 59e314b

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ export CGO_ENABLED=0
2929
export GOPROXY=https://proxy.golang.org
3030

3131
.PHONY: all
32-
all: update-data update_price fmt lint test-verbose ; $(info $(M) building $(TARGETOS)/$(TARGETARCH) binary...) @ ## Build program binary
32+
all: update-data update-price fmt lint test-verbose ; $(info $(M) building $(TARGETOS)/$(TARGETARCH) binary...) @ ## Build program binary
33+
$Q env GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) $(GO) build \
34+
-tags release \
35+
-ldflags "$(LDFLAGS_VERSION)" \
36+
-o $(BIN)/$(basename $(MODULE)) ./cmd/main.go
37+
38+
.PHONY: build
39+
build: update-data update-price ; $(info $(M) building $(TARGETOS)/$(TARGETARCH) binary...) @ ## Build program binary
3340
$Q env GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) $(GO) build \
3441
-tags release \
3542
-ldflags "$(LDFLAGS_VERSION)" \
@@ -98,8 +105,8 @@ update-data: check-deps; @ ## Update Spot Advisor data file
98105
@wget -nv $(SPOT_ADVISOR_DATA_URL) -O - > public/spot/data/spot-advisor-data.json
99106
@echo "spot advisor data updated"
100107

101-
.PHONY: update_price
102-
update_price: check-deps; @ ## Update Spot pricing data file
108+
.PHONY: update-price
109+
update-price: check-deps; @ ## Update Spot pricing data file
103110
@mkdir -p public/spot/data
104111
@wget -nv $(SPOT_PRICE_DATA_URL) -O - > public/spot/data/spot-price-data.json
105112
@sed -i'' -e "s/callback(//g" public/spot/data/spot-price-data.json

cmd/main.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,15 @@ func main() {
236236
}
237237
cli.VersionPrinter = func(c *cli.Context) {
238238
fmt.Printf("spotinfo %s\n", Version)
239-
fmt.Printf(" Build date: %s\n", BuildDate)
240-
fmt.Printf(" Git commit: %s\n", GitCommit)
241-
fmt.Printf(" Git branch: %s\n", GitBranch)
239+
if BuildDate != "" && BuildDate != "unknown" {
240+
fmt.Printf(" Build date: %s\n", BuildDate)
241+
}
242+
if GitCommit != "" {
243+
fmt.Printf(" Git commit: %s\n", GitCommit)
244+
}
245+
if GitBranch != "" {
246+
fmt.Printf(" Git branch: %s\n", GitBranch)
247+
}
242248
fmt.Printf(" Built with: %s\n", runtime.Version())
243249
}
244250

0 commit comments

Comments
 (0)