-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (29 loc) · 913 Bytes
/
Makefile
File metadata and controls
37 lines (29 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# The name of your application's binary
BINARY_NAME=smokescreen
# Use the latest Git tag as the version (or commit hash)
VERSION := $(shell git describe --tags --always)
# Define the ldflags for injecting version information
LDFLAGS := -ldflags="-X 'starless.dev/smokescreen/cmd.Version=${VERSION}'"
all: mod fmt lint clean build
# Build the Go application
build:
@echo "==> Building application..."
@echo "Version: ${VERSION}"
go build ${LDFLAGS} -o $(BINARY_NAME) .
# Tidy and verify module dependencies
mod:
@echo "==> Tidying and verifying module dependencies..."
go mod tidy
go mod verify
# Format the source code
fmt:
@echo "==> Formatting source code..."
go fmt ./...
# Run the linter
lint: mod
@echo "==> Running linter..."
go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run
# Remove the previously built binary
clean:
@echo "==> Cleaning up..."
rm -f $(BINARY_NAME)