Skip to content

Commit

Permalink
chore(*): -
Browse files Browse the repository at this point in the history
  • Loading branch information
enenumxela committed Nov 30, 2024
1 parent 16d1db1 commit d1ca51c
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 70 deletions.
28 changes: 0 additions & 28 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

11 changes: 0 additions & 11 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ updates:
schedule:
interval: "weekly"
target-branch: "dev"
commit-message:
prefix: "chore"
include: "scope"
labels:
- "Type: Maintenance"
-
package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
target-branch: "dev"
commit-message:
prefix: "chore"
include: "scope"
Expand Down
73 changes: 46 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
# Set the default shell to `/bin/sh` for executing commands in the Makefile.
# `/bin/sh` is used as it is lightweight and widely available across UNIX systems.
SHELL = /bin/sh

# Define the project name for easy reference.
# Define the project name for easy reference throughout the Makefile.
# This helps in maintaining a consistent project name and avoiding hardcoding it in multiple places.
PROJECT = "xsubfind3r"

# The default target that gets executed when the `make` command is run without arguments.
# In this case, it will trigger the `go-build` target.
all: go-build

# --- Prepare | Setup -------------------------------------------------------------------------------

.PHONY: prepare
prepare:
@# Install the latest version of Lefthook (a Git hooks manager) and set it up.
go install github.com/evilmartians/lefthook@latest && lefthook install

# --- Go(Golang) ------------------------------------------------------------------------------------

# Define common Go commands with variables for reusability and easier updates.
GOCMD=go # The main Go command.
GOMOD=$(GOCMD) mod # Go mod command for managing modules.
GOGET=$(GOCMD) get # Go get command for retrieving packages.
GOFMT=$(GOCMD) fmt # Go fmt command for formatting Go code.
GOTEST=$(GOCMD) test # Go test command for running tests.
GOBUILD=$(GOCMD) build # Go build command for building binaries.
GOINSTALL=$(GOCMD) install # Go install command for installing packages.
GOCMD=go
GOMOD=$(GOCMD) mod
GOGET=$(GOCMD) get
GOFMT=$(GOCMD) fmt
GOTEST=$(GOCMD) test
GOBUILD=$(GOCMD) build
GOINSTALL=$(GOCMD) install

# Define Go build flags for verbosity and linking.
GOFLAGS := -v # Verbose flag for Go commands to print detailed output.
LDFLAGS := -s -w # Linker flags to strip debug information (-s) and reduce binary size (-w).

# Set static linking flags for systems that are not macOS (darwin).
# Static linking allows the binary to include all required libraries in the executable.
# Verbose flag for Go commands, helpful for debugging and understanding output.
GOFLAGS := -v
# Linker flags:
# - `-s` removes the symbol table for a smaller binary size.
# - `-w` removes DWARF debugging information.
LDFLAGS := -s -w

# Enable static linking on non-macOS platforms.
# This embeds all dependencies directly into the binary, making it more portable.
ifneq ($(shell go env GOOS),darwin)
LDFLAGS := -extldflags "-static"
endif
Expand All @@ -36,39 +49,42 @@ GOLANGCILINTRUN=$(GOLANGCILINTCMD) run
# --- Go Module Management

# Tidy Go modules
# This target cleans up `go.mod` and `go.sum` files by removing any unused dependencies.
# Use this command to ensure that the module files are in a clean state.
# This cleans up `go.mod` and `go.sum` by removing unused dependencies
# and ensuring that only the required packages are listed.
.PHONY: go-mod-tidy
go-mod-tidy:
$(GOMOD) tidy

# Update Go modules
# This target updates the Go module dependencies to their latest versions.
# It fetches and updates all modules, and any indirect dependencies.
# Updates all Go dependencies to their latest versions, including both direct and indirect dependencies.
# Useful for staying up-to-date with upstream changes and bug fixes.
.PHONY: go-mod-update
go-mod-update:
$(GOGET) -f -t -u ./... # Update test dependencies.
$(GOGET) -f -u ./... # Update other dependencies.
@# Update test dependencies.
$(GOGET) -f -t -u ./...
@# Update all other dependencies.
$(GOGET) -f -u ./...

# --- Go Code Quality and Testing

# Format Go code
# This target formats all Go source files according to Go's standard formatting rules using `go fmt`.
# Formats all Go source files in the current module according to Go's standard rules.
# Consistent formatting is crucial for code readability and collaboration.
.PHONY: go-fmt
go-fmt:
$(GOFMT) ./...

# Lint Go code
# This target lints the Go source code to ensure it adheres to best practices.
# It uses `golangci-lint` to run various static analysis checks on the code.
# It first runs the `go-fmt` target to ensure the code is properly formatted.
# Runs static analysis checks on the Go code using Golangci-lint.
# Ensures the code adheres to best practices and is free from common issues.
# This target also runs `go-fmt` beforehand to ensure the code is formatted.
.PHONY: go-lint
go-lint: go-fmt
$(GOLANGCILINTRUN) $(GOLANGCILINT) ./...

# Run Go tests
# This target runs all Go tests in the current module.
# The `GOFLAGS` flag ensures that tests are run with verbose output, providing more detailed information.
# Executes all unit tests in the module with detailed output.
# The `GOFLAGS` variable is used to enable verbosity, making it easier to debug test results.
.PHONY: go-test
go-test:
$(GOTEST) $(GOFLAGS) ./...
Expand All @@ -93,8 +109,8 @@ go-install:
# --- Docker ------------------------------------------------------------------------------------

# Define common Docker commands with variables for reusability.
DOCKERCMD = docker # The main Docker command.
DOCKERBUILD = $(DOCKERCMD) build # Docker build command for building images.
DOCKERCMD = docker
DOCKERBUILD = $(DOCKERCMD) build

# Define the path to the Dockerfile.
# The Dockerfile is located in the root directory by default.
Expand Down Expand Up @@ -133,6 +149,9 @@ help:
@echo ""
@echo "Available commands:"
@echo ""
@echo " Preparation | Setup:"
@echo " prepare .................. prepare repository."
@echo ""
@echo " Go Commands:"
@echo " go-mod-tidy .............. Tidy Go modules."
@echo " go-mod-update ............ Update Go modules."
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/hueristiq/xsubfind3r

go 1.23.1
go 1.23.3

require (
dario.cat/mergo v1.0.1
github.com/hueristiq/hq-go-http v0.0.0-20241124123643-7d49a3db5287
github.com/hueristiq/hq-go-http v0.0.0-20241130130721-5381a75aed4e
github.com/hueristiq/hq-go-limiter v0.0.0-20241020114425-bdc49852dc29
github.com/hueristiq/hq-go-url v0.0.0-20241021202657-1f82b6fb3ffa
github.com/hueristiq/hq-go-url v0.0.0-20241130123020-8f3fcd1c6000
github.com/hueristiq/hqgolog v0.0.0-20230623113334-a6018965a34f
github.com/logrusorgru/aurora/v3 v3.0.0
github.com/spf13/cast v1.7.0
Expand All @@ -19,7 +19,7 @@ require (
require (
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hueristiq/hq-go-retrier v0.0.0-20241124123316-75e4987d3cb6 // indirect
github.com/hueristiq/hq-go-retrier v0.0.0-20241130122723-f060264d9262 // indirect
github.com/hueristiq/hqgoutils v0.0.0-20231024005153-bd2c47932440 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hueristiq/hq-go-http v0.0.0-20241124123643-7d49a3db5287 h1:iYtDw6sxgrhTg4TqE1TZIpmLaqwMycW+THzAvTKhxPw=
github.com/hueristiq/hq-go-http v0.0.0-20241124123643-7d49a3db5287/go.mod h1:LzguRCYZU/rvGfta50FatU4Md1EsNdBGmoWGCOCG3tw=
github.com/hueristiq/hq-go-http v0.0.0-20241130130721-5381a75aed4e h1:yamQ8PdlRHR7S6tlz///2iO0rOeDhc30GA0QGEMNwQs=
github.com/hueristiq/hq-go-http v0.0.0-20241130130721-5381a75aed4e/go.mod h1:+Qm7Z2yF7uWihVy5DEUDAYMBkCL2Bm5bIgOKlxk8ZsQ=
github.com/hueristiq/hq-go-limiter v0.0.0-20241020114425-bdc49852dc29 h1:5MT7d/clp5I73BvazJrF4A9IkcKDCkdhaPyqL7gQrjE=
github.com/hueristiq/hq-go-limiter v0.0.0-20241020114425-bdc49852dc29/go.mod h1:n1ODyTZYMyUuOIQCqHZgvobG8zWY/gxQaGeMiSnUnZw=
github.com/hueristiq/hq-go-retrier v0.0.0-20241124123316-75e4987d3cb6 h1:MrT8DTES74Y5l79N6PPPg3q/GbHQWQcats76FBs6Er0=
github.com/hueristiq/hq-go-retrier v0.0.0-20241124123316-75e4987d3cb6/go.mod h1:1SITeMGkM7cJh41P9zMoXqbp5h8fxlF9nuPdynkwjjI=
github.com/hueristiq/hq-go-retrier v0.0.0-20241130122723-f060264d9262 h1:mEJOmRcl2l0mDrk6pwLSYTrcLXWlAGsGMEQGMtcc/C8=
github.com/hueristiq/hq-go-retrier v0.0.0-20241130122723-f060264d9262/go.mod h1:0gJoaPQEgXzuXWxqGS8eMQarow9FFjRuL/zyeTZPyuw=
github.com/hueristiq/hq-go-url v0.0.0-20241021202657-1f82b6fb3ffa h1:KL5vQRk2nJxeWi2Xq+dXpzGOtiwEeXW5yjy1qGLriug=
github.com/hueristiq/hq-go-url v0.0.0-20241021202657-1f82b6fb3ffa/go.mod h1:1q7KVF3MOodsQzUkWwDwqn62L0Yjj8nLDSqZF0oirgQ=
github.com/hueristiq/hq-go-url v0.0.0-20241130123020-8f3fcd1c6000 h1:g+3YYM8vFlqvugzez1cEcotxtNB1hwSRNJ4p004iFIg=
github.com/hueristiq/hq-go-url v0.0.0-20241130123020-8f3fcd1c6000/go.mod h1:CAJBPEU92HUUGT1S1iv2tyRgFRck97AuX4gFC70mB/o=
github.com/hueristiq/hqgolog v0.0.0-20230623113334-a6018965a34f h1:JAgZOIJ+UbkENpRiOTlfg51CW0UNrUkgwLjUGiH+x9g=
github.com/hueristiq/hqgolog v0.0.0-20230623113334-a6018965a34f/go.mod h1:S5J3E3Azva5+JKv67uc+Hh3XwLDvkVYDGjEaMTFrIqg=
github.com/hueristiq/hqgoutils v0.0.0-20231024005153-bd2c47932440 h1:dpHAa9c74HgAXkZ2WPd84q2cCiF76eluuSGRw7bk7To=
Expand Down

0 comments on commit d1ca51c

Please sign in to comment.