Continuing on, lets go ahead and add air because doing reloads is lame. Also going to add a makefile because I feel like those two go together like beer and skittles.
=> air
First lets make a bin directory
Then lets add the `.air.toml` file
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[build]
bin = "./bin/app"
cmd = "go build -o ./bin/app main.go"
delay = 1000
exclude_dir = []
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = "./bin/app"
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html","gohtml","css"]
kill_delay = "0s"
log = "build-errors.log"
send_interrupt = false
stop_on_error = true
[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
time = true
[misc]
clean_on_exit = false
[screen]
clear_on_rebuild = false
Now we can add in a simple Makefile, ive used Taskfile as an alternative, but really didn't get much out of it other then having everything in golang. Which is great but not really a requirement for this project. So here is the Makfile magic: => https://github.com/go-task/task Taskfile
GOCMD = go
GOBUILD = $(GOCMD) build
GOCLEAN = $(GOCMD) clean
GOTEST = $(GOCMD) test
GOGET = $(GOCMD) get
MAIN = main.go
BINARY_NAME = ./bin/app
watch:
air
build:
$(GOBUILD) -o $(BINARY_NAME) $(MAIN)
run:
$(GOBUILD) -o $(BINARY_NAME) $(MAIN)
./$(BINARY_NAME)
test:
$(GOTEST) -v ./...
get:
$(GOGET) ./...
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
all: build run
.PHONY: build run test get clean watch all
text/gemini
This content has been proxied by September (ba2dc).