Skip to content
This repository was archived by the owner on Aug 8, 2026. It is now read-only.

Latest commit

 

History

History
77 lines (53 loc) · 2.82 KB

File metadata and controls

77 lines (53 loc) · 2.82 KB

NodeShare Make Commands Reference

This guide explains the available targets and options defined in the Makefile to build, test, format, and install the NodeShare application.


Default Target

make all

Performs the complete development cycle:

  1. Generates Go files from Protobuf definitions (make proto).
  2. Compiles the binary for the current host system (make build).
  3. Runs all package-level unit tests (make test).

Build and Code Generation

make build

Compiles the application entrypoint ./cmd/nodeshare into the target directory dist/nodeshare (or dist/nodeshare.exe on Windows).

  • Automatically triggers a rebuild of the protobuf code if necessary.
  • Compiles with optimized linker flags (-s -w) to produce a smaller binary footprint.

make proto

Regenerates the Go struct definitions from the protobuf schemas in the proto/ directory.

  • Requires both protoc and protoc-gen-go to be installed and available in the system path.
  • Resolves code-generation paths relative to the source structure.

make cross

Cross-compiles static binaries for all supported target platforms:

  • OS/Architectures: linux/amd64, linux/arm64, windows/amd64, darwin/amd64, darwin/arm64.
  • Outputs binaries into the dist/ directory labeled by platform (e.g., nodeshare-linux-amd64).

Installation

make install

Installs NodeShare system-wide for everyday command-line use.

  1. Environment Setup: Checks for an existing .env file. If not found, it clones .env.example to .env to prompt configuration.
  2. Build: Recompiles the executable for the current platform.
  3. Installation: Attempts to install the binary to /usr/local/bin/nodeshare or falls back to user local binaries at ~/.local/bin/nodeshare. If permissions are missing, it retries using sudo.

Development Utilities

make run

Builds the binary and immediately launches the NodeShare daemon in provider mode.

make fmt

Runs the official go fmt utility to format all Go source files according to Go standards.

make vet

Performs static analysis checks using go vet to catch common compiler-level errors or mistakes (like incorrect format verbs).

make lint

Runs the golangci-lint runner on all codebase packages.

  • Requires golangci-lint to be installed on the local system.

make tidy

Tidies dependencies in go.mod and go.sum, removing unused dependencies and adding missing ones.

make clean

Removes generated build artifacts:

  • Deletes the dist/ directory.
  • Cleans up generated .pb.go files from the gen/ directory.

Testing

make test

Executes all unit tests in the repository using the Go race detector (-race) to prevent synchronization bugs.

make test-v

Runs unit tests in verbose mode, showing detailed outputs for each test case.