Skip to content

Commit

Permalink
Merge pull request #1217 from timofurrer/dx/upgrade-go-1.19
Browse files Browse the repository at this point in the history
Upgrade to go 1.19
  • Loading branch information
RicePatrick committed Aug 30, 2022
2 parents 6cb41a6 + b952389 commit 9a3844c
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 570 deletions.
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17
1.19
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Documentation in [/docs](/docs) is auto-generated by [terraform-plugin-docs](htt

### Set Up Your Local Environment

You'll first need [Go](http://www.golang.org) installed on your machine (version 1.17+ is *required*).
You'll first need [Go](http://www.golang.org) installed on your machine (version 1.19+ is *required*).

1. Clone the git repository.

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/gitlabhq/terraform-provider-gitlab

go 1.17
go 1.19

require (
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
Expand Down
549 changes: 0 additions & 549 deletions go.sum

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions internal/provider/access_level_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ var validProjectAccessLevelNames = []string{
}

// NOTE(TF): the documentation here https://docs.gitlab.com/ee/api/protected_branches.html
// mentions an `60 => Admin access` level, but it actually seems to not exist.
// Ignoring here that I've every read about this ...
//
// mentions an `60 => Admin access` level, but it actually seems to not exist.
// Ignoring here that I've every read about this ...
var validProtectedBranchTagAccessLevelNames = []string{
"no one", "developer", "maintainer",
}
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/data_source_gitlab_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ var _ = registerDataSource("gitlab_project", func() *schema.Resource {
},
"repository_storage": {
Description: " Which storage shard the repository is on. (administrator only)",
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
},
"requirements_access_level": {
Description: fmt.Sprintf("Set the requirements access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/data_source_gitlab_projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -905,8 +905,8 @@ var _ = registerDataSource("gitlab_projects", func() *schema.Resource {
},
"repository_storage": {
Description: " Which storage shard the repository is on. (administrator only)",
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
},
"requirements_access_level": {
Description: fmt.Sprintf("Set the requirements access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
Expand Down
6 changes: 3 additions & 3 deletions internal/provider/resource_gitlab_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,9 @@ var resourceGitLabProjectSchema = map[string]*schema.Schema{
},
"repository_storage": {
Description: " Which storage shard the repository is on. (administrator only)",
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"requirements_access_level": {
Description: fmt.Sprintf("Set the requirements access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
Expand Down
19 changes: 10 additions & 9 deletions internal/provider/resource_gitlab_repository_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ import (
const encoding = "base64"

// NOTE: this lock is a bit of a hack to prevent parallel calls to the GitLab Repository Files API.
// If it is called concurrently, the API will return a 400 error along the lines of:
// ```
// (400 Bad Request) DELETE https://gitlab.com/api/v4/projects/30716/repository/files/somefile.yaml: 400
// {message: 9:Could not update refs/heads/master. Please refresh and try again..}
// ```
//
// This lock only solves half of the problem, where the provider is responsible for
// the concurrency. The other half is if the API is called outside of terraform at the same time
// this resource makes calls to the API.
// To mitigate this, simple retries are used.
// If it is called concurrently, the API will return a 400 error along the lines of:
// ```
// (400 Bad Request) DELETE https://gitlab.com/api/v4/projects/30716/repository/files/somefile.yaml: 400
// {message: 9:Could not update refs/heads/master. Please refresh and try again..}
// ```
//
// This lock only solves half of the problem, where the provider is responsible for
// the concurrency. The other half is if the API is called outside of terraform at the same time
// this resource makes calls to the API.
// To mitigate this, simple retries are used.
var resourceGitlabRepositoryFileApiLock = newLock()

var _ = registerResource("gitlab_repository_file", func() *schema.Resource {
Expand Down

0 comments on commit 9a3844c

Please sign in to comment.