Template
1
0

add golang setup

This commit is contained in:
OCram85 2025-02-24 08:59:31 +01:00
parent 5c6c078b65
commit 9e5f490209
7 changed files with 91 additions and 4 deletions

View File

@ -8,7 +8,6 @@ charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
[*.go] [*.go]
indent_style = tab indent_style = tab
indent_size = 4 indent_size = 4

View File

@ -1 +1,2 @@
README.md README.md
Makefile

7
.gitignore vendored
View File

@ -7,8 +7,15 @@ data/*.csv
# Ignore temp build artifacts # Ignore temp build artifacts
/bin/* /bin/*
/dist/*
!bin/.gitkeep !bin/.gitkeep
# Ignore Pester test result files # Ignore Pester test result files
coverage.xml coverage.xml
testResults.xml testResults.xml
# Ignore NodeJS modules
node_modules
# Ignore local env setups
.env

10
.prettierrc.json Normal file
View File

@ -0,0 +1,10 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"arrowParens": "always",
"bracketSpacing": true,
"printWidth": 116,
"semi": false,
"singleQuote": true,
"trailingComma": "all",
"vueIndentScriptAndStyle": true
}

View File

@ -1,10 +1,11 @@
{ {
"recommendations": [ "recommendations": [
"editorconfig.editorconfig", "editorconfig.editorconfig",
"esbenp.prettier-vscode",
"golang.go",
"vue.volar",
"eamodio.gitlens", "eamodio.gitlens",
"streetsidesoftware.code-spell-checker", "streetsidesoftware.code-spell-checker",
"streetsidesoftware.code-spell-checker-german",
"bierner.emojisense", "bierner.emojisense",
"ryanluker.vscode-coverage-gutters"
] ]
} }

View File

@ -58,7 +58,7 @@
"yaml", "yaml",
"yml" "yml"
], ],
"cSpell.language": "en-US,de-DE", "cSpell.language": "en-US",
"cSpell.customDictionaries": { "cSpell.customDictionaries": {
"project-words": { "project-words": {
"name": "project-words", "name": "project-words",

69
Makefile Normal file
View File

@ -0,0 +1,69 @@
.DEFAULT_GOAL := build
BINARY_NAME := ${REPO_NAME}
LDFLAGS := -s -w
arkanum-install:
@echo "🤖 Installing required frameworks and runtimes with arkanum..."
@arkanum install golang
@arkanum install nodejs
@echo "🚩 step done."
install:
@echo "🤖 Installing frontend dependencies...(npm)"
cd web && npm install
@echo "🤖 Install backend dependencies...(golang)"
go mod tidy
@echo "🤖 Install global helpers..."
npm install --global prettier
@echo "🚩 step done."
lint:
@echo "🤖 Running prettier linter in check mode..."
pretier -c .
prettier:
@echo "🤖 Running prettier linter in write mode..."
prettier -w .
clean:
@echo "🤖 Cleaning go cache..."
@go clean
@echo "🤖 Cleanig web / pb_public files..."
@cd web && npm run clean
@echo "🤖 Cleaning dist binaries..."
@rm dist/${BINARY_NAME}-* || echo "Files already removed or not present. Ignore this error."
@echo "🚩 step done."
build-frontend:
@echo "📦 Building frontend artifacts..."
@cd web && npm run build
@echo "🚩 step done."
frontend-dev:
@echo "🚀 Starting frontend dev server..."
@cd web && npm run dev
build-linux: clean build-frontend
@echo "📦 Building linux binary..."
@CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -a -v ldflags= '${LD_FLAGS}' -o dist/${BINARY_NAME}-linux-amd64 .
@echo "🚩 step done."
build-win: clean build-frontend
@echo "📦 Building windows binary..."
@CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -a -v ldflags= '${LD_FLAGS}' -o dist/${BINARY_NAME}-win-amd64 .
@echo "🚩 step done."
build: build-linux build-win
@ls -lh dist/
@echo "🏁 done."
dev: clean build-frontend
@echo "📦 Building linux dev binary..."
@CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -tags dev -v ldflags '${LD_FLAGS}' -o dist/${BINARY_NAME}-dev .
@echo "🚀 Starting dev server..."
dist/${BINARY_NAME}-dev serve --dev --http="0.0.0.0:1313"
serve:
@echo "🚀 Starting dev server in prod mode..."
dist/${BINARY_NAME}-linux-amd64 serve --http="0.0.0.0:1313"