-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial project with a simple hello world
- Loading branch information
Scott Bragg
committed
Dec 25, 2024
1 parent
a4b5bc1
commit 58a6e92
Showing
10 changed files
with
208 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[{*.go,Makefile,.gitmodules,go.mod,go.sum}] | ||
indent_style = tab | ||
|
||
[*.md] | ||
indent_style = tab | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml,json}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.{js,jsx,ts,tsx,css,less,sass,scss,vue,py}] | ||
indent_style = space | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,5 @@ go.work.sum | |
|
||
# env file | ||
.env | ||
|
||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
run: | ||
timeout: 5m | ||
tests: true | ||
|
||
output: | ||
# Use the updated format configuration | ||
formats: | ||
- format: colored-line-number | ||
path: stdout | ||
|
||
linters-settings: | ||
errcheck: | ||
exclude-functions: | ||
- fmt.Printf | ||
|
||
revive: | ||
config: ./revive.toml | ||
|
||
linters: | ||
enable: | ||
- revive | ||
- unused | ||
- staticcheck | ||
- gosimple | ||
- govet | ||
- errcheck | ||
enable-all: false | ||
|
||
issues: | ||
exclude-use-default: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Variables | ||
APP_NAME=nap-and-go | ||
DOCKER_IMAGE=$(APP_NAME):latest | ||
DOCKER_COMPOSE_FILE=docker-compose.yaml | ||
|
||
# Go build parameters | ||
GO_BUILD_CMD=go build | ||
GO_FILES=./... | ||
|
||
# Targets | ||
.PHONY: all build bot web run lint test clean docker docker-compose up down info | ||
|
||
# Default target | ||
all: build | ||
|
||
# Build both bot and web binaries | ||
build: bot | ||
|
||
# Build the Discord bot binary | ||
bot: | ||
$(GO_BUILD_CMD) -o bin/bot ./cmd/bot | ||
|
||
# Build the web interface binary | ||
web: | ||
$(GO_BUILD_CMD) -o bin/web ./cmd/web | ||
|
||
# Run both bot and web | ||
run: build | ||
@echo "Starting bot and web interface..." | ||
./bin/bot & ./bin/web | ||
|
||
# Lint the code | ||
lint: | ||
golangci-lint run ./... | ||
|
||
# Test the code | ||
test: | ||
go test -v $(GO_FILES) | ||
|
||
# Clean up binaries and other artifacts | ||
clean: | ||
@echo "Cleaning up..." | ||
rm -rf bin/ | ||
|
||
# Build Docker image | ||
docker: | ||
@echo "Building Docker image..." | ||
docker build -t $(DOCKER_IMAGE) . | ||
|
||
# Run using Docker Compose | ||
docker-compose: | ||
@echo "Running Docker Compose..." | ||
docker-compose -f $(DOCKER_COMPOSE_FILE) up --build | ||
|
||
# Start Docker Compose | ||
up: | ||
@echo "Starting services..." | ||
docker-compose -f $(DOCKER_COMPOSE_FILE) up | ||
|
||
# Stop Docker Compose | ||
down: | ||
@echo "Stopping services..." | ||
docker-compose -f $(DOCKER_COMPOSE_FILE) down | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
GIT_COMMIT = $(shell git rev-parse HEAD) | ||
GIT_SHA = $(shell git rev-parse --short HEAD) | ||
GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null) | ||
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean") | ||
|
||
ifdef VERSION | ||
BINARY_VERSION = $(VERSION) | ||
endif | ||
BINARY_VERSION ?= ${GIT_TAG} | ||
|
||
VERSION_METADATA = unreleased | ||
|
||
# Clear the "unreleased" string in BuildMetadata | ||
ifneq ($(GIT_TAG),) | ||
VERSION_METADATA = | ||
endif | ||
|
||
info: | ||
@echo "Version: ${VERSION}" | ||
@echo "Git Tag: ${GIT_TAG}" | ||
@echo "Git Commit: ${GIT_COMMIT}" | ||
@echo "Git Tree State: ${GIT_DIRTY}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Initializes and runs the Discord bot | ||
package main | ||
|
||
import "fmt" | ||
|
||
import "rsc.io/quote" | ||
|
||
func main() { | ||
fmt.Println(quote.Go()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Output format | ||
format = "friendly" | ||
|
||
# Rules configuration | ||
[rule] | ||
name = "indent-error-flow" | ||
enabled = true | ||
severity = "warning" | ||
|
||
[rule] | ||
name = "error-strings" | ||
enabled = true | ||
severity = "warning" | ||
arguments = ["lowercase"] | ||
|
||
# Exclusions | ||
[exclude] | ||
files = ["**/*.pb.go"] | ||
directories = ["vendor"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module github.com/faulteh/nap-and-go | ||
|
||
go 1.23.4 | ||
|
||
require rsc.io/quote v1.5.2 | ||
|
||
require ( | ||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c // indirect | ||
rsc.io/sampler v1.3.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:qgOY6WgZOaTkIIMiVjBQcw93ERBE4m30iBm00nkL0i8= | ||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||
rsc.io/quote v1.5.2 h1:w5fcysjrx7yqtD/aO+QwRjYZOKnaM9Uh2b40tElTs3Y= | ||
rsc.io/quote v1.5.2/go.mod h1:LzX7hefJvL54yjefDEDHNONDjII0t9xZLPXsUe+TKr0= | ||
rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4= | ||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Output format | ||
format = "friendly" | ||
|
||
# Rules configuration | ||
[rule] | ||
name = "indent-error-flow" | ||
enabled = true | ||
severity = "warning" | ||
|
||
[rule] | ||
name = "error-strings" | ||
enabled = true | ||
severity = "warning" | ||
arguments = ["lowercase"] | ||
|
||
# Exclusions | ||
[exclude] | ||
files = ["**/*.pb.go"] | ||
directories = ["vendor"] |