From 035ebb150b0e787a6b75b89de732b9f94d924ada Mon Sep 17 00:00:00 2001 From: zxb <919411476@qq.com> Date: Wed, 1 Nov 2023 20:26:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .air.linux.toml | 42 ++++++++++++++++++++++++++++++++++++++++++ .air.toml | 42 ++++++++++++++++++++++++++++++++++++++++++ README.MD | 5 +++++ go.mod | 3 +++ go.sum | 0 init.go | 8 ++++++++ pkg/constants/const.go | 12 ++++++++++++ 7 files changed, 112 insertions(+) create mode 100644 .air.linux.toml create mode 100644 .air.toml create mode 100644 README.MD create mode 100644 go.mod create mode 100644 go.sum create mode 100644 init.go create mode 100644 pkg/constants/const.go 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", +}