Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ linters:
excludes:
- G101 # hardcoded credentials
- G117 # exported field of "Secret" style
- G705
- G704
# https://github.com/client9/misspell
misspell:
locale: US
Expand Down
6 changes: 4 additions & 2 deletions api/admin/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestAdmin_CleanLogs(t *testing.T) {

// setup request body
body := types.Error{
Message: String("Test log cleanup"),
Message: new("Test log cleanup"),
}
data, _ := json.Marshal(body)

Expand Down Expand Up @@ -217,6 +217,8 @@ func TestAdmin_CleanLogs_ValidationEdgeCases(t *testing.T) {
}

// String is a helper routine that returns a pointer to the string value passed in.
//
//go:fix inline
func String(v string) *string {
return &v
return new(v)
}
4 changes: 0 additions & 4 deletions api/build/cancel.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ func getWorkerExecutors(c *gin.Context, w *types.Worker) (*[]types.Executor, err
}

// make the request to the worker and check the response
//
//nolint:gosec // worker address set by platform admin, not user input
resp, err := client.Do(req)
if err != nil {
return nil, err
Expand Down Expand Up @@ -276,8 +274,6 @@ func cancelBuildForExecutor(c *gin.Context, l *logrus.Entry, w *types.Worker, ex
}

// perform the request to the worker
//
//nolint:gosec // worker address set by platform admin, not user input
resp, err := client.Do(req)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion api/pipeline/expand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestExpandPipelineStagesReturnsCleanYAML(t *testing.T) {
w := httptest.NewRecorder()
c, _ := gin.CreateTestContext(w)

req := httptest.NewRequest(http.MethodPost, requestPath, nil)
req := httptest.NewRequestWithContext(t.Context(), http.MethodPost, requestPath, nil)
c.Request = req

logger := logrus.New()
Expand Down
4 changes: 2 additions & 2 deletions compiler/native/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2424,8 +2424,8 @@ func convertFileToGithubResponse(file string) (github.RepositoryContent, error)
}

content := github.RepositoryContent{
Encoding: github.Ptr(""),
Content: github.Ptr(string(body)),
Encoding: new(""),
Content: new(string(body)),
}

return content, nil
Expand Down
126 changes: 63 additions & 63 deletions database/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,16 @@ func testBuilds(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the build interface
element := reflect.TypeFor[build.BuildInterface]()
// iterate through all methods found in the build interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for builds
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

// create the users for build related functions (owners of repos)
Expand Down Expand Up @@ -485,16 +485,16 @@ func testDashboards(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the schedule interface
element := reflect.TypeFor[dashboard.DashboardInterface]()
// iterate through all methods found in the schedule interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for schedules
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

ctx := context.TODO()
Expand Down Expand Up @@ -577,16 +577,16 @@ func testExecutables(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the pipeline interface
element := reflect.TypeFor[executable.BuildExecutableInterface]()
// iterate through all methods found in the pipeline interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for pipelines
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

// create the pipelines
Expand Down Expand Up @@ -666,16 +666,16 @@ func testDeployments(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the deployment interface
element := reflect.TypeFor[deployment.DeploymentInterface]()
// iterate through all methods found in the deployment interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for deployments
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

// create the users for deployment related functions (owners of repos)
Expand Down Expand Up @@ -846,16 +846,16 @@ func testHooks(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the hook interface
element := reflect.TypeFor[hook.HookInterface]()
// iterate through all methods found in the hook interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for hooks
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

// create the users for hook related functions (owners of repos)
Expand Down Expand Up @@ -1034,15 +1034,15 @@ func testJWKs(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the jwk interface
element := reflect.TypeFor[dbJWK.JWKInterface]()
// iterate through all methods found in the jwk interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for jwks
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

for i := 0; i < resources.JWKs.Len(); i++ {
Expand Down Expand Up @@ -1133,16 +1133,16 @@ func testLogs(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the log interface
element := reflect.TypeFor[log.LogInterface]()
// iterate through all methods found in the log interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for logs
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

// create the logs
Expand Down Expand Up @@ -1290,16 +1290,16 @@ func testPipelines(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the pipeline interface
element := reflect.TypeFor[pipeline.PipelineInterface]()
// iterate through all methods found in the pipeline interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for pipelines
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

// create owners
Expand Down Expand Up @@ -1481,16 +1481,16 @@ func testRepos(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the repo interface
element := reflect.TypeFor[repo.RepoInterface]()
// iterate through all methods found in the repo interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for repos
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

// create owners
Expand Down Expand Up @@ -1697,16 +1697,16 @@ func testSchedules(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the schedule interface
element := reflect.TypeFor[schedule.ScheduleInterface]()
// iterate through all methods found in the schedule interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for schedules
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

// create owners
Expand Down Expand Up @@ -1880,16 +1880,16 @@ func testSecrets(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the secret interface
element := reflect.TypeFor[secret.SecretInterface]()
// iterate through all methods found in the secret interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for secrets
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

// create the secrets
Expand Down Expand Up @@ -2151,16 +2151,16 @@ func testServices(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the service interface
element := reflect.TypeFor[service.ServiceInterface]()
// iterate through all methods found in the service interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for services
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

// create the services
Expand Down Expand Up @@ -2325,16 +2325,16 @@ func testSteps(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the step interface
element := reflect.TypeFor[step.StepInterface]()
// iterate through all methods found in the step interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for steps
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

ctx := context.TODO()
Expand Down Expand Up @@ -2501,16 +2501,16 @@ func testUsers(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the user interface
element := reflect.TypeFor[user.UserInterface]()
// iterate through all methods found in the user interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for users
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

userOne := new(api.User)
Expand Down Expand Up @@ -2636,16 +2636,16 @@ func testWorkers(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the worker interface
element := reflect.TypeFor[worker.WorkerInterface]()
// iterate through all methods found in the worker interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for workers
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

// create the workers
Expand Down Expand Up @@ -2737,16 +2737,16 @@ func testSettings(t *testing.T, db Interface, resources *Resources) {
// capture the element type of the settings interface
element := reflect.TypeFor[dbSettings.SettingsInterface]()
// iterate through all methods found in the settings interface
for i := 0; i < element.NumMethod(); i++ {
for method := range element.Methods() {
// skip tracking the methods to create indexes and tables for settings
// since those are already called when the database engine starts
if strings.Contains(element.Method(i).Name, "Index") ||
strings.Contains(element.Method(i).Name, "Table") {
if strings.Contains(method.Name, "Index") ||
strings.Contains(method.Name, "Table") {
continue
}

// add the method name to the list of functions
methods[element.Method(i).Name] = false
methods[method.Name] = false
}

// create the settings
Expand Down
Loading
Loading