mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-03-15 17:13:46 +01:00
Enable golangci linter gomnd (#3171)
This commit is contained in:
@@ -61,7 +61,7 @@ func setupRouter(tokenReceived chan string) *gin.Engine {
|
||||
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT")
|
||||
|
||||
if c.Request.Method == "OPTIONS" {
|
||||
c.AbortWithStatus(204)
|
||||
c.AbortWithStatus(http.StatusNoContent)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ func setupRouter(tokenReceived chan string) *gin.Engine {
|
||||
err := c.BindJSON(&data)
|
||||
if err != nil {
|
||||
log.Debug().Err(err).Msg("Failed to bind JSON")
|
||||
c.JSON(400, gin.H{
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"error": "invalid request",
|
||||
})
|
||||
return
|
||||
@@ -84,7 +84,7 @@ func setupRouter(tokenReceived chan string) *gin.Engine {
|
||||
|
||||
tokenReceived <- data.Token
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"ok": "true",
|
||||
})
|
||||
})
|
||||
@@ -111,7 +111,10 @@ func openBrowser(url string) error {
|
||||
}
|
||||
|
||||
func randomPort() int {
|
||||
s1 := rand.NewSource(time.Now().UnixNano())
|
||||
r1 := rand.New(s1)
|
||||
return r1.Intn(10000) + 20000
|
||||
const minPort = 10000
|
||||
const maxPort = 65535
|
||||
|
||||
source := rand.NewSource(time.Now().UnixNano())
|
||||
rand := rand.New(source)
|
||||
return rand.Intn(maxPort-minPort+1) + minPort
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user