From 445872dd624723544213af4f54ec2c2caf748ef9 Mon Sep 17 00:00:00 2001 From: "Alex (@enenumxela)" <62714471+enenumxela@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:32:17 +0300 Subject: [PATCH] chore(*): - --- .github/workflows/codeql.yml | 7 ++--- .github/workflows/lint.yml | 6 ++-- .github/workflows/test.yml | 12 ++++---- Makefile | 60 +++++++++--------------------------- schemes/schemes_official.go | 2 ++ tlds/tlds_official.go | 8 +---- 6 files changed, 28 insertions(+), 67 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 5c29437..4726fe2 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -29,7 +29,7 @@ jobs: security-events: write steps: - - name: Checkout the repository + name: Code Checkout uses: actions/checkout@v4 with: fetch-depth: 0 @@ -38,9 +38,6 @@ jobs: uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} - - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - + - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 34d36e6..a7a8ecb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -30,14 +30,14 @@ jobs: go-version: '>=1.23' cache: false - - name: Checkout the repository + name: Code Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Run golangci-lint + name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.61.0 + version: v1.62.2 args: --timeout 5m working-directory: . \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 34235c0..8c3e94c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: name: Test strategy: matrix: - os: [ubuntu-latest, windows-latest, macOS-12] + os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - @@ -29,15 +29,15 @@ jobs: with: go-version: '>=1.23' - - name: Checkout the repository + name: Code Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - - - name: Go modules hygine + - + name: Go Module Management run: | - go clean -modcache - go mod tidy + make go-mod-clean + make go-mod-tidy working-directory: . - name: Go test diff --git a/Makefile b/Makefile index 62bc815..ffcb8b6 100644 --- a/Makefile +++ b/Makefile @@ -1,57 +1,44 @@ -# 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 throughout the Makefile. -# This helps in maintaining a consistent project name and avoiding hardcoding it in multiple places. PROJECT = "hq-go-url" -# --- Prepare | Setup ------------------------------------------------------------------------------- +# ------------------------------------------------------------------------------------------------------------------------------ +# --- 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) ------------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------------------------------------------------------ +# --- Go (Golang) -------------------------------------------------------------------------------------------------------------- +# ------------------------------------------------------------------------------------------------------------------------------ -# Define common Go commands with variables for reusability and easier updates. GOCMD=go +GOCLEAN=$(GOCMD) clean GOMOD=$(GOCMD) mod GOGET=$(GOCMD) get GOFMT=$(GOCMD) fmt GOTEST=$(GOCMD) test -# Define Go build flags for verbosity and linking. -# 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 -# Define Golangci-lint command for linting Go code. GOLANGCILINTCMD=golangci-lint GOLANGCILINTRUN=$(GOLANGCILINTCMD) run -# --- Go Module Management +.PHONY: go-mod-clean +go-mod-clean: + $(GOCLEAN) -modcache -# Tidy Go modules -# 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 -# 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: @# Update test dependencies. @@ -59,44 +46,26 @@ go-mod-update: @# Update all other dependencies. $(GOGET) -f -u ./... -# --- Go Code Generation - -# Run Go generate -# This target runs go generate ./..., which will process any //go:generate directives found in your Go source files. -# The ./... pattern ensures that the command is run on all packages within the module. .PHONY: go-generate go-generate: $(GOCMD) generate ./... -# --- Go Code Quality and Testing - -# Format Go code -# 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 -# 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 -# 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) ./... -# --- Help ----------------------------------------------------------------------------------------- +# ------------------------------------------------------------------------------------------------------------------------------ +# --- Help --------------------------------------------------------------------------------------------------------------------- +# ------------------------------------------------------------------------------------------------------------------------------ -# Display help information -# This target prints out a detailed list of all available Makefile commands for ease of use. -# It's a helpful reference for developers using the Makefile. .PHONY: help help: @echo "" @@ -112,6 +81,7 @@ help: @echo " prepare .................. prepare repository." @echo "" @echo " Go Commands:" + @echo " go-mod-clean ............. Clean Go module cache." @echo " go-mod-tidy .............. Tidy Go modules." @echo " go-mod-update ............ Update Go modules." @echo " go-generate .............. Run Go generate." @@ -123,6 +93,4 @@ help: @echo " help ..................... Display this help information" @echo "" -# Set the default goal to `help`. -# This ensures that running `make` without arguments will display the help information. .DEFAULT_GOAL = help \ No newline at end of file diff --git a/schemes/schemes_official.go b/schemes/schemes_official.go index 357d355..f14ea88 100644 --- a/schemes/schemes_official.go +++ b/schemes/schemes_official.go @@ -342,6 +342,8 @@ var Official = []string{ "tag", "taler", "teamspeak", + "teapot", + "teapots", "tel", "teliaeid", "telnet", diff --git a/tlds/tlds_official.go b/tlds/tlds_official.go index 7a0f67b..f1a0749 100644 --- a/tlds/tlds_official.go +++ b/tlds/tlds_official.go @@ -499,7 +499,6 @@ var Official = []string{ "beer", "beiarn.no", "bel.tr", - "belau.pw", "belem.br", "belluno.it", "benevento.it", @@ -974,7 +973,6 @@ var Official = []string{ "co.nz", "co.om", "co.pn", - "co.pw", "co.rs", "co.rw", "co.ss", @@ -1358,7 +1356,6 @@ var Official = []string{ "ed.ci", "ed.cr", "ed.jp", - "ed.pw", "edeka", "edogawa.tokyo.jp", "edu", @@ -1596,7 +1593,6 @@ var Official = []string{ "fauske.no", "fc.it", "fe.it", - "fed.us", "federation.aero", "fedex", "fedje.no", @@ -1890,7 +1886,6 @@ var Official = []string{ "go.jp", "go.ke", "go.kr", - "go.pw", "go.th", "go.tj", "go.tz", @@ -2042,6 +2037,7 @@ var Official = []string{ "gov.pr", "gov.ps", "gov.pt", + "gov.pw", "gov.py", "gov.qa", "gov.rs", @@ -2958,7 +2954,6 @@ var Official = []string{ "kia", "kibichuo.okayama.jp", "kids", - "kids.us", "kiengiang.vn", "kiev.ua", "kiho.mie.jp", @@ -4469,7 +4464,6 @@ var Official = []string{ "or.ke", "or.kr", "or.mu", - "or.pw", "or.th", "or.tz", "or.ug",