Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,5 +8,5 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
with:
go-version: '1.15.1'
go-version: '1.26.4'
- run: go test -coverprofile coverage.txt
2 changes: 1 addition & 1 deletion Dockerfile
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
FROM golang:1.15-alpine as builder
FROM golang:1.26.4-alpine as builder

#ENV CGO_ENABLED=0
WORKDIR /build
Expand Down
1 change: 1 addition & 0 deletions builds.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion go.mod
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
module github.com/sourcegraph/codenotify

go 1.15
go 1.26.4
16 changes: 8 additions & 8 deletions main.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -142,7 +142,7 @@ func githubActionOptions() (*options, error) {
return nil, fmt.Errorf("env var GITHUB_EVENT_PATH not set")
}

data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("unable to read GitHub event json %s: %s", path, err)
}
Expand DownExpand Up@@ -226,7 +226,7 @@ func updateComment(id, body string) error {
clientMutationId
}
}`,
map[string]interface{}{
map[string]any{
"id": id,
"body": body,
},
Expand All@@ -245,7 +245,7 @@ func addComment(subjectId, body string) error {
clientMutationId
}
}`,
map[string]interface{}{
map[string]any{
"subjectId": subjectId,
"body": body,
},
Expand All@@ -271,7 +271,7 @@ func commitCount(prNodeID string) (int, error) {
}
}
}`,
map[string]interface{}{
map[string]any{
"nodeId": prNodeID,
},
&data,
Expand DownExpand Up@@ -310,7 +310,7 @@ func existingCommentId(prNodeID string, filename string) (string, error) {
}
}
}`,
map[string]interface{}{
map[string]any{
"nodeId": prNodeID,
},
&data,
Expand All@@ -328,8 +328,8 @@ func existingCommentId(prNodeID string, filename string) (string, error) {
return "", nil
}

func graphql(query string, variables map[string]interface{}, responseData interface{}) error {
reqbody, err := json.Marshal(map[string]interface{}{
func graphql(query string, variables map[string]any, responseData any) error {
reqbody, err := json.Marshal(map[string]any{
"query": query,
"variables": variables,
})
Expand DownExpand Up@@ -370,7 +370,7 @@ func graphql(query string, variables map[string]interface{}, responseData interf
}

response := struct {
Data interface{}
Data any
Errors []struct {
Type string `json:"type"`
Path []string `json:"path"`
Expand Down
5 changes: 3 additions & 2 deletions main_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@
"bytes"
"fmt"
"io"
"io/fs"

Check failure on line 7 in main_test.go

View workflow job for this annotation

GitHub Actions/ build

"io/fs" imported and not used
"io/ioutil"
"os"
"os/exec"
Expand DownExpand Up@@ -48,7 +49,7 @@
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {

gitroot, err := ioutil.TempDir("", "codenotify")
gitroot, err := os.MkdirTemp("", "codenotify")
if err != nil {
t.Fatalf("unable to create temporary directory: %s", err)
}
Expand All@@ -64,7 +65,7 @@
t.Fatalf("unable to make directory %s: %s", dir, err)
}

if err := ioutil.WriteFile(file, []byte(content), 0666); err != nil {
if err := os.WriteFile(file, []byte(content), 0666); err != nil {
t.Fatalf("unable to write file %s: %s", file, err)
}
}
Expand Down
Loading