Skip to content

Commit

Permalink
Sort just targets alphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
miguno committed Aug 29, 2024
1 parent 0dc639f commit 330c632
Showing 1 changed file with 56 additions and 56 deletions.
112 changes: 56 additions & 56 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,63 +25,56 @@ system-info:
@echo "os: {{os()}}"
@echo "os family: {{os_family()}}"

# format source code
format:
@echo "Formatting source code ..."
gofmt -l -s -w .

# detect outdated modules (requires https://github.com/psampaz/go-mod-outdated)
outdated:
go list -u -m -json all | go-mod-outdated -update

# detect known vulnerabilities (requires https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck)
vulnerabilities:
govulncheck ./...

# detect known vulnerabilities (requires https://github.com/sonatype-nexus-community/nancy)
audit:
go list -json -m all | nancy sleuth --loud

# run linters (requires https://github.com/dominikh/go-tools)
lint:
staticcheck -f stylish ./... || \
(echo "\nRun \`just explain <LintIdentifier, e.g. SA1006>\` for details." && \
exit 1)

# explain lint identifier (e.g., "SA1006")
explain lint-identifier:
staticcheck -explain {{lint-identifier}}
# build executable for local OS
build: test-vanilla
@echo "Building executable for local OS ..."
go build -trimpath -ldflags="-X 'main.Version={{version}}'" -o app cmd/golang-docker-build-tutorial/main.go

# add missing module requirements for imported packages, removes requirements that aren't used anymore
tidy:
go mod tidy
# show test coverage
coverage:
go test -coverprofile={{coverage_profile_log}} ./...
go tool cover -html={{coverage_profile_log}}

# show dependencies
deps:
go mod graph

# run tests with colorized output (requires https://github.com/kyoh86/richgo)
test *FLAGS:
richgo test -cover {{FLAGS}} ./...
# create a docker image (requires Docker)
docker-image-create:
@echo "Creating a docker image ..."
@PROJECT_VERSION={{version}} ./create_image.sh

# run tests (vanilla), used for CI workflow
test-vanilla *FLAGS:
go test -cover {{FLAGS}} ./...
# run the docker image (requires Docker)
docker-image-run:
@echo "Running container from docker image ..."
@./start_container.sh

# show test coverage
coverage:
go test -coverprofile={{coverage_profile_log}} ./...
go tool cover -html={{coverage_profile_log}}
# size of the docker image (requires Docker)
docker-image-size:
@docker images $DOCKER_IMAGE_NAME

# run executable for local OS
run:
@echo "Running golang-docker-build-tutorial with defaults ..."
go run -ldflags="-X 'main.Version={{version}}'" cmd/golang-docker-build-tutorial/main.go
# explain lint identifier (e.g., "SA1006")
explain lint-identifier:
staticcheck -explain {{lint-identifier}}

# build executable for local OS
build: test-vanilla
@echo "Building executable for local OS ..."
go build -trimpath -ldflags="-X 'main.Version={{version}}'" -o app cmd/golang-docker-build-tutorial/main.go
# format source code
format:
@echo "Formatting source code ..."
gofmt -l -s -w .

# run linters (requires https://github.com/dominikh/go-tools)
lint:
staticcheck -f stylish ./... || \
(echo "\nRun \`just explain <LintIdentifier, e.g. SA1006>\` for details." && \
exit 1)

# detect outdated modules (requires https://github.com/psampaz/go-mod-outdated)
outdated:
go list -u -m -json all | go-mod-outdated -update

# build release executables for all supported platforms
release: test-vanilla
Expand All @@ -98,24 +91,31 @@ release: test-vanilla
GOOS=linux GOARCH=arm64 \
go build -trimpath -ldflags "-X 'main.Version={{version}}' -s -w" -o app_linux-arm64 cmd/golang-docker-build-tutorial/main.go

# create a docker image (requires Docker)
docker-image-create:
@echo "Creating a docker image ..."
@PROJECT_VERSION={{version}} ./create_image.sh

# size of the docker image (requires Docker)
docker-image-size:
@docker images $DOCKER_IMAGE_NAME

# run the docker image (requires Docker)
docker-image-run:
@echo "Running container from docker image ..."
@./start_container.sh
# run executable for local OS
run:
@echo "Running golang-docker-build-tutorial with defaults ..."
go run -ldflags="-X 'main.Version={{version}}'" cmd/golang-docker-build-tutorial/main.go

# send request to the app's HTTP endpoint (requires running container)
send-request-to-app:
curl http://localhost:8123/status

# run tests with colorized output (requires https://github.com/kyoh86/richgo)
test *FLAGS:
richgo test -cover {{FLAGS}} ./...

# run tests (vanilla), used for CI workflow
test-vanilla *FLAGS:
go test -cover {{FLAGS}} ./...

# add missing module requirements for imported packages, removes requirements that aren't used anymore
tidy:
go mod tidy

# detect known vulnerabilities (requires https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck)
vulnerabilities:
govulncheck ./...

# watch sources for changes and trigger a rebuild (requires https://github.com/watchexec/watchexec)
watch:
# Watch all go files in the current directory and all subdirectories for
Expand Down

0 comments on commit 330c632

Please sign in to comment.