commit 035ebb150b0e787a6b75b89de732b9f94d924ada Author: zxb <919411476@qq.com> Date: Wed Nov 1 20:26:27 2023 +0800 初始化项目 diff --git a/.air.linux.toml b/.air.linux.toml new file mode 100644 index 0000000..9488443 --- /dev/null +++ b/.air.linux.toml @@ -0,0 +1,42 @@ +root = "." +testdata_dir = "testdata" +tmp_dir = "tmp" + +[build] + args_bin = [] + bin = "tmp\\main.exe" + cmd = "go build -o ./tmp/main ." + delay = 1500 + 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"] + include_file = [] + kill_delay = "0s" + log = "build-errors.log" + rerun = false + rerun_delay = 500 + send_interrupt = true + stop_on_error = false + +[color] + app = "" + build = "yellow" + main = "magenta" + runner = "green" + watcher = "cyan" + +[log] + main_only = false + time = false + +[misc] + clean_on_exit = false + +[screen] + clear_on_rebuild = false + keep_scroll = true diff --git a/.air.toml b/.air.toml new file mode 100644 index 0000000..31e2bb1 --- /dev/null +++ b/.air.toml @@ -0,0 +1,42 @@ +root = "." +testdata_dir = "testdata" +tmp_dir = "tmp" + +[build] + args_bin = [] + bin = "tmp\\main.exe" + cmd = "go build -o ./tmp/main.exe ." + delay = 1500 + 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"] + include_file = [] + kill_delay = "0s" + log = "build-errors.log" + rerun = false + rerun_delay = 500 + send_interrupt = true + stop_on_error = false + +[color] + app = "" + build = "yellow" + main = "magenta" + runner = "green" + watcher = "cyan" + +[log] + main_only = false + time = false + +[misc] + clean_on_exit = false + +[screen] + clear_on_rebuild = false + keep_scroll = true diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..4c41eb3 --- /dev/null +++ b/README.MD @@ -0,0 +1,5 @@ +### 初始化项目 + +```shell +go generate -x init.go +``` \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..a047b1e --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module iptables-helper + +go 1.18 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..e69de29 diff --git a/init.go b/init.go new file mode 100644 index 0000000..80ea5e7 --- /dev/null +++ b/init.go @@ -0,0 +1,8 @@ +package main + +//go:generate go version +//go:generate go env -w GO111MODULE=on +//go:generate go env -w GOPROXY=https://goproxy.cn,direct +//go:generate go install github.com/cosmtrek/air@latest +//go:generate go install github.com/swaggo/swag/cmd/swag@latest +//go:generate go mod tidy diff --git a/pkg/constants/const.go b/pkg/constants/const.go new file mode 100644 index 0000000..66f2e51 --- /dev/null +++ b/pkg/constants/const.go @@ -0,0 +1,12 @@ +package constants + +const ( + ConfigFileName = "config" + ConfigType = "toml" +) + +var ConfigPaths = []string{ + ".", + "./conf", + "/config", +}