Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup auto-reloading #2

Merged
merged 5 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"

[build]
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ./cmd/handler/"
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
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 = false

[misc]
clean_on_exit = false

[screen]
clear_on_rebuild = false
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@
build/

# Dependency directories (remove the comment below to include it)
# vendor/
# vendor/

# temporary build files create by air
tmp/
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
all: AzureFunctions/handler
mkdir -p build
cd AzureFunctions && zip -r ../build/azure_functions.zip *
ls -lh build/azure_functions.zip

Expand All @@ -7,4 +8,10 @@ AzureFunctions/handler: cmd/handler/main.go

clean:
rm AzureFunctions/handler
rm build/*
rm build/*

dev:
# Install air if not already present
# https://github.com/cosmtrek/air
command -v air > /dev/null || curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b $(GOPATH)/bin
air
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# simplQ-golang

## Local Setup Notes

1. Golang setup: https://go.dev/doc/install
2. Start development serverL
```
daltonfury42 marked this conversation as resolved.
Show resolved Hide resolved
git clone [email protected]:SimplQ/simplQ-golang.git
cd simplQ-golang/
air
```

We use Visual Studio Code as the IDE but this is not a strict requirement. [Azure Functions](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions) plugin can be used to deploy code to Azure, but this is optional.