From b2d86370df834eed891dd2db6a9059622fd83200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20G=C3=BCnther?= Date: Tue, 20 Feb 2024 23:07:47 +0100 Subject: [PATCH] Chores --- .github/workflows/build.yaml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/lint.yaml | 2 +- .github/workflows/release.yaml | 2 +- cmd/arcdps-log-uploader/ui/textgenerator.go | 24 ++++++++++++--------- go.mod | 2 +- go.sum | 2 ++ revive.toml | 1 - 8 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f20f4cb..e0a7d1a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' # The Go version to download (if necessary) and use. + go-version-file: 'go.mod' - uses: actions/cache@v4 with: # In order: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f0c5bcd..f70652e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -37,7 +37,7 @@ jobs: uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' # The Go version to download (if necessary) and use. + go-version-file: 'go.mod' - uses: actions/cache@v4 with: # In order: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index ca01af2..c8a4c40 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.20' # The Go version to download (if necessary) and use. + go-version-file: 'go.mod' - uses: actions/cache@v4 with: # In order: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1a959b4..1727aba 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,7 +12,7 @@ jobs: uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.19' # The Go version to download (if necessary) and use. + go-version-file: 'go.mod' - name: Get the version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} diff --git a/cmd/arcdps-log-uploader/ui/textgenerator.go b/cmd/arcdps-log-uploader/ui/textgenerator.go index f9f1dc2..620b748 100644 --- a/cmd/arcdps-log-uploader/ui/textgenerator.go +++ b/cmd/arcdps-log-uploader/ui/textgenerator.go @@ -48,17 +48,19 @@ func generateMessageTextDiscord(entries []*model.ArcLog, formatOptions FormatOpt for _, entry := range result { output := "" + const tick = "`" + const space = " " if len(dates) > 1 { - output += "`" + entry.encounterTime.Format("02.01.2006") + "`" - output += " " + output += tick + entry.encounterTime.Format("02.01.2006") + tick + output += space } - output += "`" + entry.encounterTime.Format("15:04") + "`" - output += " " + output += tick + entry.encounterTime.Format("15:04") + tick + output += space if formatOptions.IncludeDuration { out := time.Time{}.Add(time.Duration(entry.arcLog.Report.Encounter.Duration) * time.Second) - output += "`" + out.Format("04m 05s") + "`" - output += " " + output += tick + out.Format("04m 05s") + tick + output += space } output += "<" @@ -73,10 +75,11 @@ func generateMessageTextDiscord(entries []*model.ArcLog, formatOptions FormatOpt var messages []string var currentMessage = "" for _, line := range lines { - var currentMessagePlusThisLine = currentMessage + "\r\n" + line + const linebreak = "\r\n" + var currentMessagePlusThisLine = currentMessage + linebreak + line if len(currentMessagePlusThisLine) > (2000 - len(headline) - 10) { messages = append(messages, currentMessage) - currentMessage = "\r\n" + line + currentMessage = linebreak + line } else { currentMessage = currentMessagePlusThisLine } @@ -147,10 +150,11 @@ func generateMessageTextTeamspeak(entries []*model.ArcLog, formatOptions FormatO var messages []string var currentMessage = "" for _, line := range lines { - var currentMessagePlusThisLine = currentMessage + "\r\n" + line + const linebreak = "\r\n" + var currentMessagePlusThisLine = currentMessage + linebreak + line if len(currentMessagePlusThisLine) > (10000 - len(headline) - 10) { messages = append(messages, currentMessage) - currentMessage = "\r\n" + line + currentMessage = linebreak + line } else { currentMessage = currentMessagePlusThisLine } diff --git a/go.mod b/go.mod index dfc3ef9..57ad6a3 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/xyaren/arcdps-log-uploader -go 1.20 +go 1.22 require ( github.com/blang/semver/v4 v4.0.0 diff --git a/go.sum b/go.sum index 683b867..0776380 100644 --- a/go.sum +++ b/go.sum @@ -17,6 +17,7 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v30 v30.1.0 h1:VLDx+UolQICEOKu2m4uAoMti1SxuEBAl7RSEG16L+Oo= github.com/google/go-github/v30 v30.1.0/go.mod h1:n8jBpHl45a/rlBUtRJMOG4GhNADUQFEufcolZ95JfU8= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= @@ -80,6 +81,7 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/revive.toml b/revive.toml index 00dd38e..84673da 100644 --- a/revive.toml +++ b/revive.toml @@ -15,7 +15,6 @@ warningCode = 0 [rule.increment-decrement] [rule.var-naming] [rule.var-declaration] -[rule.package-comments] [rule.range] [rule.receiver-naming] [rule.time-naming]