diff --git a/Dockerfile b/Dockerfile index 4233cb8..c10692c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -FROM golang:1.21 +FROM golang:1.21.4 WORKDIR /app COPY go.mod go.sum ./ RUN go mod download diff --git a/go.mod b/go.mod index e0222e2..a243ded 100644 --- a/go.mod +++ b/go.mod @@ -2,12 +2,12 @@ module github.com/hm-edu/dnscontrol-extended go 1.21 -toolchain go1.21.1 +toolchain go1.21.4 require ( github.com/StackExchange/dnscontrol/v4 v4.8.0 github.com/spf13/cobra v1.8.0 - github.com/xanzy/go-gitlab v0.94.0 + github.com/xanzy/go-gitlab v0.95.2 go.uber.org/zap v1.26.0 golang.org/x/time v0.5.0 ) diff --git a/go.sum b/go.sum index ef71e24..74929b5 100644 --- a/go.sum +++ b/go.sum @@ -64,6 +64,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/xanzy/go-gitlab v0.94.0 h1:GmBl2T5zqUHqyjkxFSvsT7CbelGdAH/dmBqUBqS+4BE= github.com/xanzy/go-gitlab v0.94.0/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI= +github.com/xanzy/go-gitlab v0.95.2 h1:4p0IirHqEp5f0baK/aQqr4TR57IsD+8e4fuyAA1yi88= +github.com/xanzy/go-gitlab v0.95.2/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI= github.com/xddxdd/ottoext v0.0.0-20221109171055-210517fa4419 h1:PT5KYEimicg1GRkBtBxCLcHWvMcBRGljOLwG/y4+T5c= github.com/xddxdd/ottoext v0.0.0-20221109171055-210517fa4419/go.mod h1:BxZUa1xZ189Ww28wRT0LjHcmHgQmPh27hqfHIwET0ok= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= diff --git a/helper/gitlab.go b/helper/gitlab.go index 3f87ced..ab10ee6 100644 --- a/helper/gitlab.go +++ b/helper/gitlab.go @@ -89,9 +89,9 @@ func GenerateGitlabIssue(zones []SubnetResponse, pat, api, projectID, zone strin } issue, _, err = client.Issues.CreateIssue(project.ID, &gitlab.CreateIssueOptions{ - Title: gitlab.String("IP usage in " + zone), - Description: gitlab.String(""), - Labels: &gitlab.Labels{strings.Join(matchingLabels, ",")}, + Title: gitlab.Ptr("IP usage in " + zone), + Description: gitlab.Ptr(""), + Labels: &gitlab.LabelOptions{strings.Join(matchingLabels, ",")}, }) if err != nil { panic(err) @@ -104,7 +104,7 @@ func GenerateGitlabIssue(zones []SubnetResponse, pat, api, projectID, zone strin _, err := client.Issues.DeleteIssue(project.ID, issue.IID) if err != nil { logger.Sugar().Warnf("Deleting issue %s failed.", issue.Title) - _, _, err := client.Issues.UpdateIssue(project.ID, issue.IID, &gitlab.UpdateIssueOptions{StateEvent: gitlab.String("close")}) + _, _, err := client.Issues.UpdateIssue(project.ID, issue.IID, &gitlab.UpdateIssueOptions{StateEvent: gitlab.Ptr("close")}) if err != nil { logger.Sugar().Errorf("Closing issue %s failed.", issue.Title) } @@ -151,13 +151,13 @@ func GenerateGitlabIssue(zones []SubnetResponse, pat, api, projectID, zone strin } } update := &gitlab.UpdateIssueOptions{ - Title: gitlab.String("IP usage in " + zone), - Description: gitlab.String(description), - Labels: &gitlab.Labels{strings.Join(matchingLabels, ",")}, + Title: gitlab.Ptr("IP usage in " + zone), + Description: gitlab.Ptr(description), + Labels: &gitlab.LabelOptions{strings.Join(matchingLabels, ",")}, } if issue.State == "closed" { logger.Sugar().Warnf("Reopening issue for %s", zone) - update.StateEvent = gitlab.String("reopen") + update.StateEvent = gitlab.Ptr("reopen") } _, _, err = client.Issues.UpdateIssue(project.ID, issue.IID, update) if err != nil { @@ -187,7 +187,7 @@ func GenerateGitlabIssue(zones []SubnetResponse, pat, api, projectID, zone strin for _, item := range zones[i:] { if len([]byte(description)) > (1024 * 512) { description += "\n\nPlease check comments" - _, _, err := client.Notes.CreateIssueNote(project.ID, issue.IID, &gitlab.CreateIssueNoteOptions{Body: gitlab.String(description)}) + _, _, err := client.Notes.CreateIssueNote(project.ID, issue.IID, &gitlab.CreateIssueNoteOptions{Body: gitlab.Ptr(description)}) if err != nil { logger.Sugar().Fatal(zap.Error(err)) } @@ -199,7 +199,7 @@ func GenerateGitlabIssue(zones []SubnetResponse, pat, api, projectID, zone strin } if i == len(zones) { if !inserted { - _, _, err := client.Notes.CreateIssueNote(project.ID, issue.IID, &gitlab.CreateIssueNoteOptions{Body: gitlab.String(description)}) + _, _, err := client.Notes.CreateIssueNote(project.ID, issue.IID, &gitlab.CreateIssueNoteOptions{Body: gitlab.Ptr(description)}) if err != nil { logger.Sugar().Fatal(zap.Error(err)) }