diff options
author | silverwind <me@silverwind.io> | 2023-07-09 13:58:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-09 11:58:06 +0000 |
commit | 887a683af97b570a0fb117068c980f3086133ae4 (patch) | |
tree | c9d5d41c40a9d2fbeb40a8be27a60d5c13132b69 /modules | |
parent | 115f40e43368fefc776232a2df289b2fcadbb11d (diff) | |
download | gitea-887a683af97b570a0fb117068c980f3086133ae4.tar.gz gitea-887a683af97b570a0fb117068c980f3086133ae4.zip |
Update tool dependencies, lock govulncheck and actionlint (#25655)
- Update all tool dependencies
- Lock `govulncheck` and `actionlint` to their latest tags
---------
Co-authored-by: 6543 <m.huber@kithara.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/activitypub/client.go | 14 | ||||
-rw-r--r-- | modules/activitypub/user_settings.go | 12 | ||||
-rw-r--r-- | modules/context/api.go | 4 | ||||
-rw-r--r-- | modules/git/batch_reader.go | 20 | ||||
-rw-r--r-- | modules/git/commit.go | 2 | ||||
-rw-r--r-- | modules/git/git.go | 2 | ||||
-rw-r--r-- | modules/git/repo_base_nogogit.go | 2 | ||||
-rw-r--r-- | modules/git/repo_index.go | 2 | ||||
-rw-r--r-- | modules/git/signature_nogogit.go | 13 | ||||
-rw-r--r-- | modules/nosql/manager.go | 2 | ||||
-rw-r--r-- | modules/queue/workerqueue.go | 2 |
11 files changed, 36 insertions, 39 deletions
diff --git a/modules/activitypub/client.go b/modules/activitypub/client.go index ed5c9990d6..fa1b57638f 100644 --- a/modules/activitypub/client.go +++ b/modules/activitypub/client.go @@ -63,19 +63,19 @@ type Client struct { // NewClient function func NewClient(user *user_model.User, pubID string) (c *Client, err error) { if err = containsRequiredHTTPHeaders(http.MethodGet, setting.Federation.GetHeaders); err != nil { - return + return nil, err } else if err = containsRequiredHTTPHeaders(http.MethodPost, setting.Federation.PostHeaders); err != nil { - return + return nil, err } priv, err := GetPrivateKey(user) if err != nil { - return + return nil, err } privPem, _ := pem.Decode([]byte(priv)) privParsed, err := x509.ParsePKCS1PrivateKey(privPem.Bytes) if err != nil { - return + return nil, err } c = &Client{ @@ -99,14 +99,14 @@ func (c *Client) NewRequest(b []byte, to string) (req *http.Request, err error) buf := bytes.NewBuffer(b) req, err = http.NewRequest(http.MethodPost, to, buf) if err != nil { - return + return nil, err } req.Header.Add("Content-Type", ActivityStreamsContentType) req.Header.Add("Date", CurrentTime()) req.Header.Add("User-Agent", "Gitea/"+setting.AppVer) signer, _, err := httpsig.NewSigner(c.algs, c.digestAlg, c.postHeaders, httpsig.Signature, httpsigExpirationTime) if err != nil { - return + return nil, err } err = signer.SignRequest(c.priv, c.pubID, req, b) return req, err @@ -116,7 +116,7 @@ func (c *Client) NewRequest(b []byte, to string) (req *http.Request, err error) func (c *Client) Post(b []byte, to string) (resp *http.Response, err error) { var req *http.Request if req, err = c.NewRequest(b, to); err != nil { - return + return nil, err } resp, err = c.client.Do(req) return resp, err diff --git a/modules/activitypub/user_settings.go b/modules/activitypub/user_settings.go index 2d156c17e6..20b3d759c2 100644 --- a/modules/activitypub/user_settings.go +++ b/modules/activitypub/user_settings.go @@ -15,22 +15,22 @@ func GetKeyPair(user *user_model.User) (pub, priv string, err error) { var settings map[string]*user_model.Setting settings, err = user_model.GetSettings(user.ID, []string{user_model.UserActivityPubPrivPem, user_model.UserActivityPubPubPem}) if err != nil { - return + return pub, priv, err } else if len(settings) == 0 { if priv, pub, err = util.GenerateKeyPair(rsaBits); err != nil { - return + return pub, priv, err } if err = user_model.SetUserSetting(user.ID, user_model.UserActivityPubPrivPem, priv); err != nil { - return + return pub, priv, err } if err = user_model.SetUserSetting(user.ID, user_model.UserActivityPubPubPem, pub); err != nil { - return + return pub, priv, err } - return + return pub, priv, err } else { priv = settings[user_model.UserActivityPubPrivPem].SettingValue pub = settings[user_model.UserActivityPubPubPem].SettingValue - return + return pub, priv, err } } diff --git a/modules/context/api.go b/modules/context/api.go index 93a587d436..a367597e8a 100644 --- a/modules/context/api.go +++ b/modules/context/api.go @@ -294,7 +294,7 @@ func ReferencesGitRepo(allowEmpty ...bool) func(ctx *APIContext) (cancel context return func(ctx *APIContext) (cancel context.CancelFunc) { // Empty repository does not have reference information. if ctx.Repo.Repository.IsEmpty && !(len(allowEmpty) != 0 && allowEmpty[0]) { - return + return nil } // For API calls. @@ -303,7 +303,7 @@ func ReferencesGitRepo(allowEmpty ...bool) func(ctx *APIContext) (cancel context gitRepo, err := git.OpenRepository(ctx, repoPath) if err != nil { ctx.Error(http.StatusInternalServerError, "RepoRef Invalid repo "+repoPath, err) - return + return cancel } ctx.Repo.GitRepo = gitRepo // We opened it, we should close it diff --git a/modules/git/batch_reader.go b/modules/git/batch_reader.go index 75539c0d0a..891e8a2384 100644 --- a/modules/git/batch_reader.go +++ b/modules/git/batch_reader.go @@ -148,27 +148,25 @@ func CatFileBatch(ctx context.Context, repoPath string) (WriteCloserError, *bufi func ReadBatchLine(rd *bufio.Reader) (sha []byte, typ string, size int64, err error) { typ, err = rd.ReadString('\n') if err != nil { - return + return sha, typ, size, err } if len(typ) == 1 { typ, err = rd.ReadString('\n') if err != nil { - return + return sha, typ, size, err } } idx := strings.IndexByte(typ, ' ') if idx < 0 { log.Debug("missing space typ: %s", typ) - err = ErrNotExist{ID: string(sha)} - return + return sha, typ, size, ErrNotExist{ID: string(sha)} } sha = []byte(typ[:idx]) typ = typ[idx+1:] idx = strings.IndexByte(typ, ' ') if idx < 0 { - err = ErrNotExist{ID: string(sha)} - return + return sha, typ, size, ErrNotExist{ID: string(sha)} } sizeStr := typ[idx+1 : len(typ)-1] @@ -285,14 +283,12 @@ func ParseTreeLine(rd *bufio.Reader, modeBuf, fnameBuf, shaBuf []byte) (mode, fn // Read the Mode & fname readBytes, err = rd.ReadSlice('\x00') if err != nil { - return + return mode, fname, sha, n, err } idx := bytes.IndexByte(readBytes, ' ') if idx < 0 { log.Debug("missing space in readBytes ParseTreeLine: %s", readBytes) - - err = &ErrNotExist{} - return + return mode, fname, sha, n, &ErrNotExist{} } n += idx + 1 @@ -319,7 +315,7 @@ func ParseTreeLine(rd *bufio.Reader, modeBuf, fnameBuf, shaBuf []byte) (mode, fn } n += len(fnameBuf) if err != nil { - return + return mode, fname, sha, n, err } fnameBuf = fnameBuf[:len(fnameBuf)-1] fname = fnameBuf @@ -331,7 +327,7 @@ func ParseTreeLine(rd *bufio.Reader, modeBuf, fnameBuf, shaBuf []byte) (mode, fn read, err = rd.Read(shaBuf[idx:20]) n += read if err != nil { - return + return mode, fname, sha, n, err } idx += read } diff --git a/modules/git/commit.go b/modules/git/commit.go index ff654f394d..729e3b4672 100644 --- a/modules/git/commit.go +++ b/modules/git/commit.go @@ -435,7 +435,7 @@ func (c *Commit) GetBranchName() (string, error) { // LoadBranchName load branch name for commit func (c *Commit) LoadBranchName() (err error) { if len(c.Branch) != 0 { - return + return nil } c.Branch, err = c.GetBranchName() diff --git a/modules/git/git.go b/modules/git/git.go index c9d174e118..12d2f94e51 100644 --- a/modules/git/git.go +++ b/modules/git/git.go @@ -171,7 +171,7 @@ func InitFull(ctx context.Context) (err error) { } if err = InitSimple(ctx); err != nil { - return + return err } // when git works with gnupg (commit signing), there should be a stable home for gnupg commands diff --git a/modules/git/repo_base_nogogit.go b/modules/git/repo_base_nogogit.go index e0f2d563b3..414e4eb1a8 100644 --- a/modules/git/repo_base_nogogit.go +++ b/modules/git/repo_base_nogogit.go @@ -87,7 +87,7 @@ func (repo *Repository) CatFileBatchCheck(ctx context.Context) (WriteCloserError // Close this repository, in particular close the underlying gogitStorage if this is not nil func (repo *Repository) Close() (err error) { if repo == nil { - return + return nil } if repo.batchCancel != nil { repo.batchCancel() diff --git a/modules/git/repo_index.go b/modules/git/repo_index.go index 5ff2a2e4fc..34dd1e0129 100644 --- a/modules/git/repo_index.go +++ b/modules/git/repo_index.go @@ -48,7 +48,7 @@ func (repo *Repository) readTreeToIndex(id SHA1, indexFilename ...string) error func (repo *Repository) ReadTreeToTemporaryIndex(treeish string) (filename, tmpDir string, cancel context.CancelFunc, err error) { tmpDir, err = os.MkdirTemp("", "index") if err != nil { - return + return filename, tmpDir, cancel, err } filename = filepath.Join(tmpDir, ".tmp-index") diff --git a/modules/git/signature_nogogit.go b/modules/git/signature_nogogit.go index a203d5ce6d..25277f99d5 100644 --- a/modules/git/signature_nogogit.go +++ b/modules/git/signature_nogogit.go @@ -43,12 +43,13 @@ func (s *Signature) Decode(b []byte) { // // but without the "author " at the beginning (this method should) // be used for author and committer. +// FIXME: there are a lot of "return sig, err" (but the err is also nil), that's the old behavior, to avoid breaking func newSignatureFromCommitline(line []byte) (sig *Signature, err error) { sig = new(Signature) emailStart := bytes.LastIndexByte(line, '<') emailEnd := bytes.LastIndexByte(line, '>') if emailStart == -1 || emailEnd == -1 || emailEnd < emailStart { - return + return sig, err } if emailStart > 0 { // Empty name has already occurred, even if it shouldn't @@ -58,7 +59,7 @@ func newSignatureFromCommitline(line []byte) (sig *Signature, err error) { hasTime := emailEnd+2 < len(line) if !hasTime { - return + return sig, err } // Check date format. @@ -66,7 +67,7 @@ func newSignatureFromCommitline(line []byte) (sig *Signature, err error) { if firstChar >= 48 && firstChar <= 57 { idx := bytes.IndexByte(line[emailEnd+2:], ' ') if idx < 0 { - return + return sig, err } timestring := string(line[emailEnd+2 : emailEnd+2+idx]) @@ -75,14 +76,14 @@ func newSignatureFromCommitline(line []byte) (sig *Signature, err error) { idx += emailEnd + 3 if idx >= len(line) || idx+5 > len(line) { - return + return sig, err } timezone := string(line[idx : idx+5]) tzhours, err1 := strconv.ParseInt(timezone[0:3], 10, 64) tzmins, err2 := strconv.ParseInt(timezone[3:], 10, 64) if err1 != nil || err2 != nil { - return + return sig, err } if tzhours < 0 { tzmins *= -1 @@ -92,7 +93,7 @@ func newSignatureFromCommitline(line []byte) (sig *Signature, err error) { } else { sig.When, err = time.Parse(GitTimeLayout, string(line[emailEnd+2:])) if err != nil { - return + return sig, err } } return sig, err diff --git a/modules/nosql/manager.go b/modules/nosql/manager.go index 31e43297dc..375c2b5d00 100644 --- a/modules/nosql/manager.go +++ b/modules/nosql/manager.go @@ -71,7 +71,7 @@ func valToTimeDuration(vs []string) (result time.Duration) { result = time.Duration(val) } if err == nil { - return + return result } } return result diff --git a/modules/queue/workerqueue.go b/modules/queue/workerqueue.go index e0d5183bd9..b28fd88027 100644 --- a/modules/queue/workerqueue.go +++ b/modules/queue/workerqueue.go @@ -93,7 +93,7 @@ func (q *WorkerPoolQueue[T]) GetQueueItemNumber() int { func (q *WorkerPoolQueue[T]) FlushWithContext(ctx context.Context, timeout time.Duration) (err error) { if q.isBaseQueueDummy() { - return + return nil } log.Debug("Try to flush queue %q with timeout %v", q.GetName(), timeout) |