88 "context"
99 "encoding/json"
1010 "fmt"
11- "io/ioutil "
11+ "io"
1212 "net/http"
1313 "strconv"
1414 "strings"
@@ -85,7 +85,8 @@ import (
8585// "$ref": "#/definitions/Error"
8686
8787// CreateBuild represents the API handler to create a build in the configured backend.
88- // nolint: funlen,gocyclo // ignore function length and cyclomatic complexity
88+ //
89+ //nolint:funlen,gocyclo // ignore function length and cyclomatic complexity
8990func CreateBuild (c * gin.Context ) {
9091 // capture middleware values
9192 m := c .MustGet ("metadata" ).(* types.Metadata )
@@ -307,7 +308,7 @@ func CreateBuild(c *gin.Context) {
307308
308309 // check if the pipeline did not already exist in the database
309310 //
310- // nolint: dupl // ignore duplicate code
311+ //nolint:dupl // ignore duplicate code
311312 if pipeline == nil {
312313 pipeline = compiled
313314 pipeline .SetRepoID (r .GetID ())
@@ -327,7 +328,7 @@ func CreateBuild(c *gin.Context) {
327328 // send API call to capture the created pipeline
328329 pipeline , err = database .FromContext (c ).GetPipelineForRepo (pipeline .GetCommit (), r )
329330 if err != nil {
330- // nolint: lll // ignore long line length due to error message
331+ //nolint:lll // ignore long line length due to error message
331332 retErr := fmt .Errorf ("unable to create new build: failed to get new pipeline %s/%s: %w" , r .GetFullName (), pipeline .GetCommit (), err )
332333
333334 util .HandleError (c , http .StatusInternalServerError , retErr )
@@ -380,7 +381,8 @@ func CreateBuild(c *gin.Context) {
380381
381382// skipEmptyBuild checks if the build should be skipped due to it
382383// not containing any steps besides init or clone.
383- // nolint: goconst // ignore init and clone constants
384+ //
385+ //nolint:goconst // ignore init and clone constants
384386func skipEmptyBuild (p * pipeline.Build ) string {
385387 if len (p .Stages ) == 1 {
386388 if p .Stages [0 ].Name == "init" {
@@ -792,7 +794,7 @@ func GetOrgBuilds(c *gin.Context) {
792794 }
793795 // Only show public repos to non-admins
794796 //
795- // nolint: goconst // ignore admin constant
797+ //nolint:goconst // ignore admin constant
796798 if perm != "admin" {
797799 filters ["visibility" ] = constants .VisibilityPublic
798800 }
@@ -922,7 +924,8 @@ func GetBuild(c *gin.Context) {
922924// "$ref": "#/definitions/Error"
923925
924926// RestartBuild represents the API handler to restart an existing build in the configured backend.
925- // nolint: funlen // ignore statement count
927+ //
928+ //nolint:funlen // ignore statement count
926929func RestartBuild (c * gin.Context ) {
927930 // capture middleware values
928931 m := c .MustGet ("metadata" ).(* types.Metadata )
@@ -1134,7 +1137,7 @@ func RestartBuild(c *gin.Context) {
11341137
11351138 // check if the pipeline did not already exist in the database
11361139 //
1137- // nolint: dupl // ignore duplicate code
1140+ //nolint:dupl // ignore duplicate code
11381141 if pipeline == nil {
11391142 pipeline = compiled
11401143 pipeline .SetRepoID (r .GetID ())
@@ -1154,7 +1157,7 @@ func RestartBuild(c *gin.Context) {
11541157 // send API call to capture the created pipeline
11551158 pipeline , err = database .FromContext (c ).GetPipelineForRepo (pipeline .GetCommit (), r )
11561159 if err != nil {
1157- // nolint: lll // ignore long line length due to error message
1160+ //nolint:lll // ignore long line length due to error message
11581161 retErr := fmt .Errorf ("unable to get new pipeline %s/%s: %w" , r .GetFullName (), pipeline .GetCommit (), err )
11591162
11601163 util .HandleError (c , http .StatusInternalServerError , retErr )
@@ -1465,7 +1468,7 @@ func getPRNumberFromBuild(b *library.Build) (int, error) {
14651468// execution. This creates all resources, like steps
14661469// and services, for the build in the configured backend.
14671470// TODO:
1468- // - return build and error
1471+ // - return build and error.
14691472func planBuild (database database.Service , p * pipeline.Build , b * library.Build , r * library.Repo ) error {
14701473 // update fields in build object
14711474 b .SetCreated (time .Now ().UTC ().Unix ())
@@ -1601,7 +1604,8 @@ func cleanBuild(database database.Service, b *library.Build, services []*library
16011604// "$ref": "#/definitions/Error"
16021605
16031606// CancelBuild represents the API handler to cancel a running build.
1604- // nolint: funlen // ignore statement count
1607+ //
1608+ //nolint:funlen // ignore statement count
16051609func CancelBuild (c * gin.Context ) {
16061610 // capture middleware values
16071611 b := build .Retrieve (c )
@@ -1674,7 +1678,7 @@ func CancelBuild(c *gin.Context) {
16741678 defer resp .Body .Close ()
16751679
16761680 // Read Response Body
1677- respBody , err := ioutil .ReadAll (resp .Body )
1681+ respBody , err := io .ReadAll (resp .Body )
16781682 if err != nil {
16791683 retErr := fmt .Errorf ("unable to read response from %s: %w" , u , err )
16801684 util .HandleError (c , http .StatusBadRequest , retErr )
0 commit comments