Skip to content

Commit

Permalink
refactor: Update dependencies and remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Jul 13, 2024
1 parent 9073f1c commit 96ba586
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 30 deletions.
5 changes: 2 additions & 3 deletions backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ require (
github.com/apex/log v1.9.0 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/crawlab-team/crawlab/db v0.0.0-20240614095218-7b4ee8399ab0 // indirect
github.com/crawlab-team/crawlab/fs v0.0.0-20240614095218-7b4ee8399ab0 // indirect
Expand Down Expand Up @@ -80,10 +79,10 @@ require (
github.com/jackc/pgconn v1.11.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.2.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.10.0 // indirect
github.com/jackc/pgx/v4 v4.15.0 // indirect
github.com/jackc/pgx/v4 v4.18.2 // indirect
github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand Down
5 changes: 2 additions & 3 deletions core/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ require (
github.com/fsnotify/fsnotify v1.7.0
github.com/gavv/httpexpect/v2 v2.16.0
github.com/gin-gonic/gin v1.10.0
github.com/go-git/go-git/v5 v5.12.0
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.3
Expand Down Expand Up @@ -107,10 +106,10 @@ require (
github.com/jackc/pgconn v1.11.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.2.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.10.0 // indirect
github.com/jackc/pgx/v4 v4.15.0 // indirect
github.com/jackc/pgx/v4 v4.18.2 // indirect
github.com/jaytaylor/html2text v0.0.0-20180606194806-57d518f124b0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand Down
17 changes: 17 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,23 @@ github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639 h1:mV02weKRL81bEnm8A0HT1/CAelMQDBuQIfLw8n+d6xI=
github.com/imroc/req v0.3.2/go.mod h1:F+NZ+2EFSo6EFXdeIbpfE9hcC233id70kf0byW97Caw=
github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
github.com/jackc/pgconn v1.14.0/go.mod h1:9mBNlny0UvkgJdCDvdVHYSjI+8tD2rnKK69Wz8ti++E=
github.com/jackc/pgconn v1.14.3 h1:bVoTr12EGANZz66nZPkMInAV/KHD2TxH9npjXXgiB3w=
github.com/jackc/pgconn v1.14.3/go.mod h1:RZbme4uasqzybK2RK5c65VsHxoyaml09lx3tXOcO/VM=
github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A=
github.com/jackc/pgproto3/v2 v2.3.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
github.com/jackc/pgproto3/v2 v2.3.3 h1:1HLSx5H+tXR9pW3in3zaztoEwQYRC9SQaYUHjTSUOag=
github.com/jackc/pgproto3/v2 v2.3.3/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgtype v1.14.0 h1:y+xUdabmyMkJLyApYuPj38mW+aAIqCe5uuBB51rH3Vw=
github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4=
github.com/jackc/pgx/v4 v4.18.0/go.mod h1:FydWkUyadDmdNH/mHnGob881GawxeEm7TcMCzkb+qQE=
github.com/jackc/pgx/v4 v4.18.2 h1:xVpYkNR5pk5bMCZGfClbO962UIqVABcAGt7ha1s/FeU=
github.com/jackc/pgx/v4 v4.18.2/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw=
github.com/jackc/puddle v1.2.1 h1:gI8os0wpRXFd4FiAY2dWiqRK037tjj3t7rKFeO4X5iw=
github.com/jackc/puddle v1.3.0 h1:eHK/5clGOatcjX3oWGBO/MpxpbHzSwud5EWTSCI+MX0=
github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
Expand Down Expand Up @@ -875,13 +890,15 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm
golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
Expand Down
49 changes: 25 additions & 24 deletions vcs/test/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"fmt"
"github.com/crawlab-team/crawlab/vcs"
"github.com/go-git/go-billy/v5/memfs"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/storage/memory"
"github.com/stretchr/testify/require"
"io/ioutil"
"os"
"path"
"testing"
Expand Down Expand Up @@ -61,7 +61,7 @@ func TestGitClient_CommitAllAndCheckoutBranch(t *testing.T) {

// commit
filePath := path.Join(T.LocalRepoPath, T.TestFileName)
err = ioutil.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
err = os.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
require.Nil(t, err)
err = T.LocalRepo.CommitAll(T.TestCommitMessage)
require.Nil(t, err)
Expand All @@ -86,7 +86,7 @@ func TestGitClient_Push(t *testing.T) {

// commit
filePath := path.Join(T.LocalRepoPath, T.TestFileName)
err = ioutil.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
err = os.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
require.Nil(t, err)
err = T.LocalRepo.CommitAll(T.TestCommitMessage)
require.Nil(t, err)
Expand All @@ -102,7 +102,7 @@ func TestGitClient_Reset(t *testing.T) {

// file
filePath := path.Join(T.LocalRepoPath, T.TestFileName)
err = ioutil.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
err = os.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
require.Nil(t, err)

// reset
Expand All @@ -118,7 +118,7 @@ func TestGitClient_GetLogs(t *testing.T) {

// file
filePath := path.Join(T.LocalRepoPath, T.TestFileName)
err = ioutil.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
err = os.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
require.Nil(t, err)
err = T.LocalRepo.CommitAll(T.TestCommitMessage)
require.Nil(t, err)
Expand All @@ -136,7 +136,7 @@ func TestGitClient_InitWithHttpAuth(t *testing.T) {

// get credentials
var cred Credential
data, err := ioutil.ReadFile("credentials.json")
data, err := os.ReadFile("credentials.json")
require.Nil(t, err)
err = json.Unmarshal(data, &cred)
require.Nil(t, err)
Expand All @@ -159,9 +159,9 @@ func TestGitClient_InitWithHttpAuth(t *testing.T) {
require.Nil(t, err)

// validate
files, err := ioutil.ReadDir(T.AuthRepoPath)
files, err := os.ReadDir(T.AuthRepoPath)
require.Greater(t, len(files), 0)
data, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "README.md"))
data, err = os.ReadFile(path.Join(T.AuthRepoPath, "README.md"))
require.Nil(t, err)

// dispose
Expand All @@ -175,7 +175,7 @@ func TestGitClient_MoveBranch(t *testing.T) {

// get credentials
var cred Credential
data, err := ioutil.ReadFile("credentials.json")
data, err := os.ReadFile("credentials.json")
require.Nil(t, err)
err = json.Unmarshal(data, &cred)
require.Nil(t, err)
Expand All @@ -188,6 +188,7 @@ func TestGitClient_MoveBranch(t *testing.T) {
vcs.WithUsername(cred.Username),
vcs.WithPassword(cred.Password),
)
require.Nil(t, err)

// pull
err = c.Pull(vcs.WithBranchNamePull(vcs.GitBranchNameMain))
Expand All @@ -214,7 +215,7 @@ func TestGitClient_PullWithHttpAuth(t *testing.T) {

// get credentials
var cred Credential
data, err := ioutil.ReadFile("credentials.json")
data, err := os.ReadFile("credentials.json")
require.Nil(t, err)
err = json.Unmarshal(data, &cred)
require.Nil(t, err)
Expand Down Expand Up @@ -245,9 +246,9 @@ func TestGitClient_PullWithHttpAuth(t *testing.T) {
require.Nil(t, err)

// validate
files, err := ioutil.ReadDir(T.AuthRepoPath)
files, err := os.ReadDir(T.AuthRepoPath)
require.Greater(t, len(files), 0)
data, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "README.md"))
data, err = os.ReadFile(path.Join(T.AuthRepoPath, "README.md"))
require.Nil(t, err)

// dispose
Expand All @@ -261,7 +262,7 @@ func TestGitClient_CheckoutRemoteBranchWithHttpAuth(t *testing.T) {

// get credentials
var cred Credential
data, err := ioutil.ReadFile("credentials.json")
data, err := os.ReadFile("credentials.json")
require.Nil(t, err)
err = json.Unmarshal(data, &cred)
require.Nil(t, err)
Expand All @@ -284,23 +285,23 @@ func TestGitClient_CheckoutRemoteBranchWithHttpAuth(t *testing.T) {
require.Nil(t, err)

// validate
_, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "MAIN"))
_, err = os.ReadFile(path.Join(T.AuthRepoPath, "MAIN"))
require.Nil(t, err)

// checkout remote branch
err = c.CheckoutBranchWithRemote(vcs.GitBranchNameRelease, vcs.GitRemoteNameOrigin, nil)
require.Nil(t, err)

// validate
_, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "RELEASE"))
_, err = os.ReadFile(path.Join(T.AuthRepoPath, "RELEASE"))
require.Nil(t, err)

// checkout remote branch
err = c.CheckoutBranchWithRemote(vcs.GitBranchNameDevelop, vcs.GitRemoteNameOrigin, nil)
require.Nil(t, err)

// validate
_, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "DEVELOP"))
_, err = os.ReadFile(path.Join(T.AuthRepoPath, "DEVELOP"))
require.Nil(t, err)

// dispose
Expand All @@ -314,7 +315,7 @@ func TestGitClient_InitWithSshAuth_PrivateKey(t *testing.T) {

// get credentials
var cred Credential
data, err := ioutil.ReadFile("credentials.json")
data, err := os.ReadFile("credentials.json")
require.Nil(t, err)
err = json.Unmarshal(data, &cred)
require.Nil(t, err)
Expand Down Expand Up @@ -342,9 +343,9 @@ func TestGitClient_InitWithSshAuth_PrivateKey(t *testing.T) {
require.Nil(t, err)

// validate
files, err := ioutil.ReadDir(T.AuthRepoPath)
files, err := os.ReadDir(T.AuthRepoPath)
require.Greater(t, len(files), 0)
data, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "README.md"))
data, err = os.ReadFile(path.Join(T.AuthRepoPath, "README.md"))
require.Nil(t, err)

// dispose
Expand All @@ -358,7 +359,7 @@ func TestGitClient_InitWithSshAuth_PrivateKeyPath(t *testing.T) {

// get credentials
var cred Credential
data, err := ioutil.ReadFile("credentials.json")
data, err := os.ReadFile("credentials.json")
require.Nil(t, err)
err = json.Unmarshal(data, &cred)
require.Nil(t, err)
Expand All @@ -383,9 +384,9 @@ func TestGitClient_InitWithSshAuth_PrivateKeyPath(t *testing.T) {
require.Nil(t, err)

// validate
files, err := ioutil.ReadDir(T.AuthRepoPath)
files, err := os.ReadDir(T.AuthRepoPath)
require.Greater(t, len(files), 0)
data, err = ioutil.ReadFile(path.Join(T.AuthRepoPath, "README.md"))
data, err = os.ReadFile(path.Join(T.AuthRepoPath, "README.md"))
require.Nil(t, err)
}

Expand Down Expand Up @@ -449,7 +450,7 @@ func TestGitClient_IsRemoteChanged(t *testing.T) {

// get credentials
var cred Credential
data, err := ioutil.ReadFile("credentials.json")
data, err := os.ReadFile("credentials.json")
require.Nil(t, err)
err = json.Unmarshal(data, &cred)
require.Nil(t, err)
Expand Down Expand Up @@ -487,7 +488,7 @@ func TestGitClient_IsRemoteChanged(t *testing.T) {
// commit and push
testFileName := fmt.Sprintf("test-%d.txt", time.Now().Unix())
filePath := path.Join(c1.GetPath(), testFileName)
err = ioutil.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
err = os.WriteFile(filePath, []byte(T.TestFileContent), os.FileMode(0766))
require.Nil(t, err)
err = c1.Add(testFileName)
require.Nil(t, err)
Expand Down

0 comments on commit 96ba586

Please sign in to comment.