Skip to content

Commit

Permalink
Merge pull request #62 from deflect-ca/refactor/go-upgrade-1.22
Browse files Browse the repository at this point in the history
Upgrade go to 1.22 and upgrades go mods
  • Loading branch information
jeremy5189 authored Aug 27, 2024
2 parents 214650a + 264bdc0 commit e77f08e
Show file tree
Hide file tree
Showing 10 changed files with 331 additions and 243 deletions.
40 changes: 32 additions & 8 deletions .air.toml
Original file line number Diff line number Diff line change
@@ -1,49 +1,63 @@
# Config file for [Air](https://github.com/cosmtrek/air) in TOML format

# COPY ./.air.toml /opt/banjax/
# RUN go get -u github.com/cosmtrek/air
# CMD ["air"]
# Config file for [Air](https://github.com/air-verse/air) in TOML format

# Working directory
# . or absolute path, please note that the directories following must be under root.
root = "."
tmp_dir = "tmp"

[build]
# Array of commands to run before each build
pre_cmd = []
# Just plain old shell command. You could use `make` as well.
cmd = "go build -o ./banjax ."
# Array of commands to run after ^C
post_cmd = []
# Binary file yields from `cmd`.
bin = "banjax"
# Customize binary, can setup environment variables when run your app.
full_bin = "APP_ENV=dev APP_USER=air ./banjax --config-file /opt/banjax/banjax-config.yaml"
full_bin = "APP_ENV=dev APP_USER=air ./banjax"
# Add additional arguments when running binary (bin/full_bin). Will run './tmp/main hello world'.
args_bin = ["--config-file", "/opt/banjax/banjax-config.yaml"]
# Watch these filename extensions.
include_ext = ["go", "tpl", "tmpl", "html"]
# Ignore these filename extensions or directories.
exclude_dir = ["assets", "tmp", "vendor", "frontend/node_modules"]
# Watch these directories if you specified.
include_dir = []
# Watch these files.
include_file = []
# Exclude files.
exclude_file = []
# Exclude specific regular expressions.
exclude_regex = ["_test.go"]
exclude_regex = ["_test\\.go"]
# Exclude unchanged files.
exclude_unchanged = true
# Follow symlink for directories
follow_symlink = true
# This log file places in your tmp_dir.
log = "air.log"
# Poll files for changes instead of using fsnotify.
poll = false
# Poll interval (defaults to the minimum interval of 500ms).
poll_interval = 500 # ms
# It's not necessary to trigger build each time file changes if it's too frequent.
delay = 1000 # ms
# Stop running old binary when build errors occur.
stop_on_error = true
# Send Interrupt signal before killing process (windows does not support this feature)
send_interrupt = false
# Delay after sending Interrupt signal
kill_delay = 500 # ms
kill_delay = 500 # nanosecond
# Rerun binary or not
rerun = false
# Delay after each execution
rerun_delay = 500

[log]
# Show log time
time = false
# Only show main log (silences watcher, build, runner)
main_only = false

[color]
# Customize each part's color. If no color found, use the raw app log.
Expand All @@ -55,3 +69,13 @@ runner = "green"
[misc]
# Delete tmp directory on exit
clean_on_exit = true

[screen]
clear_on_rebuild = true
keep_scroll = true

# Enable live-reloading on the browser.
[proxy]
enabled = true
proxy_port = 8090
app_port = 8080
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.17.x]
go-version: [1.22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -19,7 +19,7 @@ jobs:
integration-tests:
strategy:
matrix:
go-version: [1.17.x]
go-version: [1.22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -34,7 +34,7 @@ jobs:
performance-tests:
strategy:
matrix:
go-version: [1.17.x]
go-version: [1.22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

FROM golang:1.17.0-buster
FROM golang:1.22.6-bookworm

RUN set -x \
&& DEBIAN_FRONTEND=noninteractive apt-get update \
Expand All @@ -30,9 +30,8 @@ EXPOSE 8081
WORKDIR /opt/banjax

# To enable live reload for dev, uncomment the following lines
#COPY ./.air.toml /opt/banjax/
#RUN go mod edit -replace github.com/imdario/mergo=dario.cat/[email protected]
#RUN go get -u github.com/cosmtrek/[email protected]
#RUN mkdir -p /opt/banjax/tmp
#CMD ["air"]
# COPY ./.air.toml /opt/banjax/
# RUN go install github.com/air-verse/air@latest
# RUN mkdir -p /opt/banjax/tmp
# CMD ["air", "-c", ".air.toml"]
CMD ["./banjax"]
50 changes: 30 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
module github.com/deflect-ca/banjax

go 1.17
go 1.22

require (
github.com/coreos/go-iptables v0.6.0
github.com/coreos/go-iptables v0.7.0
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/gin-gonic/gin v1.7.7
github.com/go-playground/validator/v10 v10.11.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0
github.com/gin-gonic/gin v1.10.0
github.com/go-playground/validator/v10 v10.22.0 // indirect
github.com/google/uuid v1.6.0
github.com/hpcloud/tail v1.0.0
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.15.2 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/segmentio/kafka-go v0.4.31
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect
github.com/segmentio/kafka-go v0.4.47
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0
Expand All @@ -28,19 +27,30 @@ require (
github.com/brianvoe/gofakeit/v6 v6.16.0
github.com/gonetx/ipset v0.1.0
github.com/jeremy5189/ipfilter-no-iploc/v2 v2.0.3
github.com/stretchr/testify v1.7.1
github.com/stretchr/testify v1.9.0
)

require (
github.com/bytedance/sonic v1.12.1 // indirect
github.com/bytedance/sonic/loader v0.2.0 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.5 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pierrec/lz4/v4 v4.1.14 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.9.0 // indirect
golang.org/x/net v0.28.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit e77f08e

Please sign in to comment.