Skip to content

Commit

Permalink
build: Upgrade go to v1.22 along with packages (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
reobin authored Jun 21, 2024
1 parent eaa25d2 commit 15abec3
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 279 deletions.
6 changes: 2 additions & 4 deletions cli/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import (

"github.com/vimcolorschemes/worker/internal/database"
"github.com/vimcolorschemes/worker/internal/dotenv"
"github.com/vimcolorschemes/worker/internal/emoji"
"github.com/vimcolorschemes/worker/internal/github"

"go.mongodb.org/mongo-driver/bson"

gogithub "github.com/google/go-github/v32/github"
gogithub "github.com/google/go-github/v62/github"
)

var repositoryCountLimit int
Expand Down Expand Up @@ -71,13 +70,12 @@ func Import(_force bool, _debug bool, repoKey string) bson.M {
}

func getImportRepositoryObject(repository *gogithub.Repository) bson.M {
description := emoji.ConvertColonEmojis(repository.GetDescription())
return bson.M{
"_id": repository.GetID(),
"owner.name": repository.GetOwner().GetLogin(),
"owner.avatarURL": repository.GetOwner().GetAvatarURL(),
"name": repository.GetName(),
"description": description,
"description": repository.GetDescription(),
"githubURL": repository.GetHTMLURL(),
"githubCreatedAt": repository.GetCreatedAt().Time,
"homepageURL": repository.GetHomepage(),
Expand Down
29 changes: 19 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
module github.com/vimcolorschemes/worker

go 1.15
go 1.22

require (
github.com/enescakir/emoji v1.0.0 // indirect
github.com/google/go-github/v32 v32.1.0
github.com/joho/godotenv v1.3.0
go.mongodb.org/mongo-driver v1.4.3
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
golang.org/x/tools v0.1.7 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
github.com/google/go-github/v62 v62.0.0
github.com/joho/godotenv v1.5.1
go.mongodb.org/mongo-driver v1.15.0
golang.org/x/oauth2 v0.20.0
)

require (
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/montanaflynn/stats v0.7.1 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20240424034433-3c2c7870ae76 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/text v0.15.0 // indirect
)
231 changes: 45 additions & 186 deletions go.sum

Large diffs are not rendered by default.

10 changes: 0 additions & 10 deletions internal/emoji/emoji.go

This file was deleted.

49 changes: 0 additions & 49 deletions internal/emoji/emoji_test.go

This file was deleted.

10 changes: 5 additions & 5 deletions internal/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package file

import (
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"os"
"regexp"
"strings"

"github.com/google/go-github/v32/github"
"github.com/google/go-github/v62/github"
)

// GetFileURLsWithExtensions returns all URLs with a certain extension given a URL list
Expand Down Expand Up @@ -43,7 +43,7 @@ func GetRemoteFileContent(fileURL string) (string, error) {
return "", fmt.Errorf("status code: %d", response.StatusCode)
}

bodyBytes, err := ioutil.ReadAll(response.Body)
bodyBytes, err := io.ReadAll(response.Body)
if err != nil {
return "", err
}
Expand All @@ -53,7 +53,7 @@ func GetRemoteFileContent(fileURL string) (string, error) {

// GetLocalFileContent returns the file content of a local file at a path
func GetLocalFileContent(path string) (string, error) {
content, err := ioutil.ReadFile(path)
content, err := os.ReadFile(path)
if err != nil {
return "", err
}
Expand Down Expand Up @@ -100,7 +100,7 @@ func RemoveLinesInFile(expression string, path string) error {

newFileContent := strings.Join(newLines, "\n")

err = ioutil.WriteFile(path, []byte(newFileContent), 0600)
err = os.WriteFile(path, []byte(newFileContent), 0600)
if err != nil {
return err
}
Expand Down
15 changes: 7 additions & 8 deletions internal/file/file_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package file

import (
"io/ioutil"
"net/http"
"os"
"reflect"
"testing"

"github.com/google/go-github/v32/github"
"github.com/google/go-github/v62/github"
"github.com/vimcolorschemes/worker/internal/test"
)

Expand Down Expand Up @@ -241,7 +240,7 @@ func TestAppendToFile(t *testing.T) {
t.Error("Incorrect result for AppendToFile, did not create file")
}

actualContent, err := ioutil.ReadFile(target)
actualContent, err := os.ReadFile(target)
if err != nil {
t.Error("Incorrect result for AppendToFile, error reading file")
}
Expand Down Expand Up @@ -270,7 +269,7 @@ func TestAppendToFile(t *testing.T) {
t.Errorf("Error during AppendToFile, %s", err)
}

actualContent, err := ioutil.ReadFile(target)
actualContent, err := os.ReadFile(target)
if err != nil {
t.Error("Incorrect result for AppendToFile, error reading file")
}
Expand Down Expand Up @@ -306,7 +305,7 @@ func TestAppendToFile(t *testing.T) {

expectedContent := "hello, world"

actualContent, err := ioutil.ReadFile(target)
actualContent, err := os.ReadFile(target)
if err != nil {
t.Error("Incorrect result for AppendToFile, error reading file")
}
Expand Down Expand Up @@ -343,7 +342,7 @@ func TestRemoveLinesInFile(t *testing.T) {
t.Errorf("Incorrect result for RemoveLinesInFile, got error: %s", err)
}

fileContent, err := ioutil.ReadFile(target)
fileContent, err := os.ReadFile(target)
if err != nil {
t.Error("Incorrect result for RemoveLinesInFile, error reading file")
}
Expand Down Expand Up @@ -380,7 +379,7 @@ func TestRemoveLinesInFile(t *testing.T) {
t.Errorf("Incorrect result for RemoveLinesInFile, got error: %s", err)
}

fileContent, err := ioutil.ReadFile(target)
fileContent, err := os.ReadFile(target)
if err != nil {
t.Error("Incorrect result for RemoveLinesInFile, error reading file")
}
Expand Down Expand Up @@ -418,7 +417,7 @@ func TestRemoveLinesInFile(t *testing.T) {
t.Errorf("Incorrect result for RemoveLinesInFile, got error: %s", err)
}

fileContent, err := ioutil.ReadFile(target)
fileContent, err := os.ReadFile(target)
if err != nil {
t.Error("Incorrect result for RemoveLinesInFile, error reading file")
}
Expand Down
6 changes: 3 additions & 3 deletions internal/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/vimcolorschemes/worker/internal/dotenv"
"github.com/vimcolorschemes/worker/internal/repository"

gogithub "github.com/google/go-github/v32/github"
gogithub "github.com/google/go-github/v62/github"
"golang.org/x/oauth2"
)

Expand Down Expand Up @@ -86,7 +86,7 @@ func GetLastCommitAt(repository *gogithub.Repository) time.Time {
return time.Time{}
}

return commits[0].Commit.Author.GetDate()
return commits[0].Commit.Author.Date.Time
}

func GetFileLastCommitAt(repository *gogithub.Repository, file *gogithub.RepositoryContent) time.Time {
Expand Down Expand Up @@ -118,7 +118,7 @@ func GetFileLastCommitAt(repository *gogithub.Repository, file *gogithub.Reposit
return time.Time{}
}

return commits[0].Commit.Author.GetDate()
return commits[0].Commit.Author.Date.Time
}

// GetRepositoryFileURLs returns all file URLs in a repository
Expand Down
2 changes: 1 addition & 1 deletion internal/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sort"
"time"

gogithub "github.com/google/go-github/v32/github"
gogithub "github.com/google/go-github/v62/github"

"github.com/vimcolorschemes/worker/internal/date"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

gogithub "github.com/google/go-github/v32/github"
gogithub "github.com/google/go-github/v62/github"
dateUtil "github.com/vimcolorschemes/worker/internal/date"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/vim/vim.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"regexp"
"strings"

gogithub "github.com/google/go-github/v32/github"
gogithub "github.com/google/go-github/v62/github"
"github.com/vimcolorschemes/worker/internal/file"
"github.com/vimcolorschemes/worker/internal/github"
"github.com/vimcolorschemes/worker/internal/repository"
Expand Down
2 changes: 1 addition & 1 deletion internal/vim/vim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"testing"

"github.com/google/go-github/v32/github"
"github.com/google/go-github/v62/github"
"github.com/vimcolorschemes/worker/internal/repository"
"github.com/vimcolorschemes/worker/internal/test"
)
Expand Down

0 comments on commit 15abec3

Please sign in to comment.