Skip to content

Commit aa0d0b0

Browse files
Bump golangci/golangci-lint-action from 6.5.2 to 7.0.0 (#159)
* Bump golangci/golangci-lint-action from 6.5.2 to 7.0.0 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.5.2 to 7.0.0. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](golangci/golangci-lint-action@v6.5.2...v7.0.0) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Address new linter issues --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Stefan Agner <[email protected]>
1 parent ab9672c commit aa0d0b0

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v4
1313
- name: golangci-lint
14-
uses: golangci/golangci-lint-action@v6.5.2
14+
uses: golangci/golangci-lint-action@v7.0.0
1515
with:
1616
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
1717
version: latest

http.go

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,23 @@ import (
1212
"strings"
1313
)
1414

15-
var regexASCII = regexp.MustCompile(`\[\d+m`)
15+
var regexASCII = regexp.MustCompile(`\x1b\[\d+m`)
1616

1717
func httpIndex(w http.ResponseWriter, r *http.Request) {
1818
if r.URL.Path != "/" && r.URL.Path != "/auth/authorize" {
1919
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
2020
return
2121
}
22-
data, _ := os.ReadFile(wwwRoot + "/index.html")
22+
data, err := os.ReadFile(wwwRoot + "/index.html")
23+
if err != nil {
24+
log.Printf("failed to read index.html: %v", err)
25+
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
26+
return
27+
}
2328

24-
w.Write(data)
29+
if _, err := w.Write(data); err != nil {
30+
log.Printf("failed to write response: %v", err)
31+
}
2532
}
2633

2734
func httpUnauthorized(w http.ResponseWriter, r *http.Request) {
@@ -40,7 +47,11 @@ func httpLogs(w http.ResponseWriter, r *http.Request) {
4047
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
4148
return
4249
}
43-
defer response.Body.Close()
50+
defer func() {
51+
if err := response.Body.Close(); err != nil {
52+
log.Printf("error closing response body: %v", err)
53+
}
54+
}()
4455

4556
data, err := io.ReadAll(response.Body)
4657
if err != nil {
@@ -50,7 +61,9 @@ func httpLogs(w http.ResponseWriter, r *http.Request) {
5061
}
5162

5263
logs := regexASCII.ReplaceAllLiteralString(string(data), "")
53-
w.Write([]byte(logs))
64+
if _, err := w.Write([]byte(logs)); err != nil {
65+
log.Printf("failed to write response: %v", err)
66+
}
5467
}
5568

5669
func httpSupervisorProxy(w http.ResponseWriter, r *http.Request) {
@@ -65,8 +78,7 @@ func httpSupervisorProxy(w http.ResponseWriter, r *http.Request) {
6578

6679
u, err := url.Parse("http://" + supervisorHost + "/")
6780
if err != nil {
68-
// Handle error in parsing URL
69-
w.Write([]byte(err.Error()))
81+
http.Error(w, "Internal Server Error: "+err.Error(), http.StatusInternalServerError)
7082
return
7183
}
7284

@@ -106,10 +118,11 @@ func httpSupervisorProxy(w http.ResponseWriter, r *http.Request) {
106118
// Add authorization header
107119
r.Header.Add("Authorization", "Bearer "+os.Getenv("SUPERVISOR_TOKEN"))
108120

109-
if cleanPath == "/logs" {
121+
switch cleanPath {
122+
case "/logs":
110123
// for logs download add text/plain headers
111124
r.Header.Add("Accept", "text/plain")
112-
} else if cleanPath == "/logs/follow" {
125+
case "/logs/follow":
113126
// Set FlushInterval to enable streaming
114127
proxy.FlushInterval = -1
115128
}

mdns.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ func getOutboundIP() net.IP {
3939
if err != nil {
4040
log.Fatal(err)
4141
}
42-
defer conn.Close()
42+
defer func() {
43+
if err := conn.Close(); err != nil {
44+
log.Printf("error closing mdns connection: %v", err)
45+
}
46+
}()
4347

4448
localAddr := conn.LocalAddr().(*net.UDPAddr)
4549

0 commit comments

Comments
 (0)