Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(build): update Go version and linter /documentation workflows #1789

Merged
merged 1 commit into from
Feb 24, 2025
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
8 changes: 0 additions & 8 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@
'github.com/hashicorp/terraform-plugin-{/,}**',
],
},
{
matchFileNames: [
'tools/go.mod',
'tools/go.sum',
],
commitMessageExtra: '({{currentVersion}} → {{newVersion}}) in /tools',
groupName: 'tools',
},
{
matchFileNames: [
'examples/**',
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
filters: |
go:
- '**/*.go'
- 'tools/go.mod'

- name: Setup Go
uses: actions/setup-go@v5
Expand All @@ -36,9 +35,11 @@ jobs:
go-version-file: "go.mod"
cache-dependency-path: |
go.sum
tools/go.sum

- name: Lint code
if: ${{ steps.filter.outputs.go == 'true' }}
run: |
go run -modfile=tools/go.mod github.com/golangci/golangci-lint/cmd/golangci-lint run -v --timeout 5m
uses: golangci/golangci-lint-action@v6
with:
# renovate: datasource=github-releases depName=golangci/golangci-lint
version: v1.64.5
args: -v --timeout=10m
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ ability to merge PRs and respond to issues.

The compiled binaries will be placed in the `dist` directory.

A portion of the documentation is generated from the source code. To update the documentation, run:

```sh
make docs
```

## IDE support

If you are using VS Code, feel free to copy `settings.json` from `.vscode/settings.example.json`.
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ TARGETS=darwin linux windows
TERRAFORM_PLUGIN_EXTENSION=
VERSION=0.72.0# x-release-please-version

# renovate: datasource=github-releases depName=golangci/golangci-lint
GOLANGCI_LINT_VERSION=v1.64.5

# check if opentofu is installed and use it if it is,
# otherwise use terraform
ifeq ($(shell tofu -version 2>/dev/null),)
Expand Down Expand Up @@ -109,16 +112,16 @@ testacc:

.PHONY: lint
lint:
go run -modfile=tools/go.mod github.com/golangci/golangci-lint/cmd/golangci-lint run --fix
@docker run -t --rm -v $$(pwd):/app -v ~/.cache/golangci-lint/$(GOLANGCI_LINT_VERSION):/root/.cache -w /app golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) golangci-lint run --fix

.PHONY: release-build
release-build:
go run -modfile=tools/go.mod github.com/goreleaser/goreleaser build --clean --skip=validate
goreleaser build --clean --skip=validate

.PHONY: docs
docs:
@mkdir -p ./build/docs-gen
@cd ./tools && go generate tools.go
@go generate main.go

.PHONY: targets
targets: $(TARGETS)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ However, we will try to maintain backward compatibility between provider version
- [Proxmox Virtual Environment](https://www.proxmox.com/en/proxmox-virtual-environment/) 8.x
- TLS 1.3 for the Proxmox API endpoint (legacy TLS 1.2 is optionally supported)
- [Terraform](https://www.terraform.io/downloads.html) 1.5.x+ or [OpenTofu](https://opentofu.org) 1.6.x+
- [Go](https://golang.org/doc/install) 1.23 (to build the provider plugin)
- [Go](https://golang.org/doc/install) 1.24 (to build the provider plugin)

## Using the Provider

Expand Down
4 changes: 1 addition & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: "Provider: Proxmox Virtual Environment"

# Proxmox Provider

This provider for [Terraform](https://www.terraform.io/) is used for interacting with resources supported by [Proxmox](https://www.proxmox.com/en/).
This provider for [Terraform](https://www.terraform.io/) / [OpenTofu](https://opentofu.org/) is used for interacting with resources supported by [Proxmox VE](https://www.proxmox.com/en/products/proxmox-virtual-environment/overview).
The provider needs to be configured with the proper endpoints and credentials before it can be used.

Use the navigation to the left to read about the available resources.
Expand Down Expand Up @@ -239,8 +239,6 @@ provider "proxmox" {
}
```

-> The token authentication is taking precedence over the password authentication.

-> Not all Proxmox API operations are supported via API Token.
You may see errors like
`error creating container: received an HTTP 403 response - Reason: Permission check failed (changing feature flags for privileged container is only allowed for root@pam)` or
Expand Down
5 changes: 2 additions & 3 deletions fwprovider/test/test_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package test

import (
"bytes"
"context"
"fmt"
"net/url"
"sync"
Expand Down Expand Up @@ -265,11 +264,11 @@ func muxProviders(t *testing.T) map[string]func() (tfprotov6.ProviderServer, err
// Init mux servers
return map[string]func() (tfprotov6.ProviderServer, error){
"proxmox": func() (tfprotov6.ProviderServer, error) {
return tf6muxserver.NewMuxServer(context.Background(),
return tf6muxserver.NewMuxServer(t.Context(),
providerserver.NewProtocol6(fwprovider.New("test")()),
func() tfprotov6.ProviderServer {
sdkV2Provider, err := tf5to6server.UpgradeServer(
context.Background(),
t.Context(),
func() tfprotov5.ProviderServer {
return schema.NewGRPCProviderServer(
sdkV2provider.ProxmoxVirtualEnvironment(),
Expand Down
3 changes: 1 addition & 2 deletions fwprovider/types/hardwaremapping/path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package hardwaremapping

import (
"context"
"testing"

"github.com/hashicorp/terraform-plugin-go/tftypes"
Expand Down Expand Up @@ -52,7 +51,7 @@ func TestPathValueFromTerraform(t *testing.T) {
name, func(t *testing.T) {
t.Parallel()

ctx := context.TODO()
ctx := t.Context()
val, err := PathType{}.ValueFromTerraform(ctx, test.val)

if err == nil && test.expectError {
Expand Down
5 changes: 2 additions & 3 deletions fwprovider/types/ip_addr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package types

import (
"context"
"testing"

"github.com/hashicorp/terraform-plugin-framework/path"
Expand Down Expand Up @@ -52,7 +51,7 @@ func Test_IPAddrTypeValueFromTerraform(t *testing.T) {
t.Run(name, func(t *testing.T) {
t.Parallel()

ctx := context.TODO()
ctx := t.Context()
val, err := IPAddrType{}.ValueFromTerraform(ctx, test.val)

if err == nil && test.expectError {
Expand Down Expand Up @@ -105,7 +104,7 @@ func Test_IPAddrTypeValidate(t *testing.T) {
t.Run(name, func(t *testing.T) {
t.Parallel()

ctx := context.TODO()
ctx := t.Context()

diags := IPAddrType{}.Validate(ctx, test.val, path.Root("test"))

Expand Down
5 changes: 2 additions & 3 deletions fwprovider/types/ip_cidr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package types

import (
"context"
"testing"

"github.com/hashicorp/terraform-plugin-framework/path"
Expand Down Expand Up @@ -52,7 +51,7 @@ func Test_IPCIDRTypeValueFromTerraform(t *testing.T) {
t.Run(name, func(t *testing.T) {
t.Parallel()

ctx := context.TODO()
ctx := t.Context()
val, err := IPCIDRType{}.ValueFromTerraform(ctx, test.val)

if err == nil && test.expectError {
Expand Down Expand Up @@ -113,7 +112,7 @@ func Test_IPCIDRTypeValidate(t *testing.T) {
t.Run(name, func(t *testing.T) {
t.Parallel()

ctx := context.TODO()
ctx := t.Context()

diags := IPCIDRType{}.Validate(ctx, test.val, path.Root("test"))

Expand Down
3 changes: 1 addition & 2 deletions fwprovider/types/nodes/apt/standard_repo_handle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package apt

import (
"context"
"testing"

"github.com/hashicorp/terraform-plugin-go/tftypes"
Expand Down Expand Up @@ -103,7 +102,7 @@ func TestStandardRepoHandleValueFromTerraform(t *testing.T) {
name, func(t *testing.T) {
t.Parallel()

ctx := context.TODO()
ctx := t.Context()
val, err := StandardRepoHandleType{}.ValueFromTerraform(ctx, test.val)

if err == nil && test.expectError {
Expand Down
41 changes: 33 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/bpg/terraform-provider-proxmox

go 1.23.0
go 1.24.0

tool github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs

require (
github.com/Microsoft/go-winio v0.6.2
Expand All @@ -27,13 +29,22 @@ require (
)

require (
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect
github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/ProtonMail/go-crypto v1.1.3 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/bmatcuk/doublestar/v4 v4.8.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/hashicorp/cli v1.1.6 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
Expand All @@ -48,33 +59,47 @@ require (
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.22.0 // indirect
github.com/hashicorp/terraform-json v0.24.0 // indirect
github.com/hashicorp/terraform-plugin-docs v0.20.1 // indirect
github.com/hashicorp/terraform-registry-address v0.2.4 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/posener/complete v1.2.3 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yuin/goldmark v1.7.7 // indirect
github.com/yuin/goldmark-meta v1.1.0 // indirect
github.com/zclconf/go-cty v1.16.2 // indirect
golang.org/x/mod v0.22.0 // indirect
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
go.opentelemetry.io/otel v1.34.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/mod v0.23.0 // indirect
golang.org/x/sync v0.11.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.22.0 // indirect
golang.org/x/tools v0.28.0 // indirect
golang.org/x/tools v0.30.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
google.golang.org/grpc v1.69.4 // indirect
google.golang.org/protobuf v1.36.3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 // indirect
google.golang.org/grpc v1.70.0 // indirect
google.golang.org/protobuf v1.36.4 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading