1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00

chore: use the same .golangci.yml as the runner & gofumpt over gofmt (#206)

To prepare for a smooth merge in the runner codebase.

- run with --fix for gofumpt and golangci
- manual edits for
  - disabling useless package naming warning
  - rename variables that had underscore in their name
  - remove trailing else at the end of a few functions

Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/206
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren 2025-07-28 12:26:41 +00:00 committed by earl-warren
parent ed98625ae9
commit c377159121
37 changed files with 138 additions and 140 deletions

View file

@ -29,9 +29,7 @@ const (
urlBase = "/_apis/artifactcache"
)
var (
urlRegex = regexp.MustCompile(`/(\w+)(/_apis/artifactcache/.+)`)
)
var urlRegex = regexp.MustCompile(`/(\w+)(/_apis/artifactcache/.+)`)
type Handler struct {
router *httprouter.Router
@ -55,7 +53,7 @@ type RunData struct {
RepositoryMAC string
}
func (h *Handler) CreateRunData(fullName string, runNumber string, timestamp string) RunData {
func (h *Handler) CreateRunData(fullName, runNumber, timestamp string) RunData {
mac := computeMac(h.cacheSecret, fullName, runNumber, timestamp)
return RunData{
RepositoryFullName: fullName,
@ -65,7 +63,7 @@ func (h *Handler) CreateRunData(fullName string, runNumber string, timestamp str
}
}
func StartHandler(targetHost string, outboundIP string, port uint16, cacheSecret string, logger logrus.FieldLogger) (*Handler, error) {
func StartHandler(targetHost, outboundIP string, port uint16, cacheSecret string, logger logrus.FieldLogger) (*Handler, error) {
h := &Handler{}
if logger == nil {
@ -142,7 +140,7 @@ func (h *Handler) newReverseProxy(targetHost string) (*httputil.ReverseProxy, er
h.logger.Warn(fmt.Sprintf("Tried starting a cache proxy with id %s, which does not exist.", id))
return
}
var runData = data.(RunData)
runData := data.(RunData)
uri := matches[2]
r.SetURL(targetURL)