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

Conversation

bpg
Copy link
Owner

@bpg bpg commented Feb 23, 2025

  • Update Go version from 1.23 to 1.24 in go.mod and README
  • Migrate documentation generation from tools/ to main.go
  • Update Makefile to use go generate in main.go for docs
  • Remove tools/ directory and related configuration
  • Update GitHub Actions and Renovate configuration
  • Simplify documentation generation process

Contributor's Note

  • I have added / updated documentation in /docs for any user-facing features or additions.
  • I have added / updated acceptance tests in /fwprovider/tests for any new or updated resources / data sources.
  • I have ran make example to verify that the change works as expected.

Proof of Work

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #0000 | Relates #0000

Summary by CodeRabbit

  • New Features

    • Provider documentation now highlights support for both Terraform and OpenTofu, offering clearer guidance on resource interactions.
  • Documentation

    • Automated documentation generation has been improved.
    • Updated contribution guidelines to simplify doc updates.
  • Chores

    • Enhanced linting and build processes using containerized tooling with extended timeouts.
    • Upgraded the Go version requirement and streamlined dependency management.
    • Removed obsolete tool configuration files to simplify maintenance.

- Update Go version from 1.23 to 1.24 in go.mod and README
- Migrate documentation generation from tools/ to main.go
- Update Makefile to use go generate in main.go for docs
- Remove tools/ directory and related configuration
- Update GitHub Actions and Renovate configuration
- Simplify documentation generation process

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Copy link

coderabbitai bot commented Feb 24, 2025

Walkthrough

The pull request implements multiple configuration and dependency updates. It removes the tools-specific configuration from Renovate and the lint workflow, streamlines Makefile targets, and updates documentation instructions. Several test files are modified to use the testing context instead of a generic background or TODO context. Additionally, the Go module is upgraded with new dependencies and versions, new code generation directives are added in the main file, and tools-related module files are removed.

Changes

File(s) Change Summary
.github/renovate.json5 Removed the configuration block matching tools/go.mod & tools/go.sum with custom commit message and group name.
.github/workflows/golangci-lint.yml Updated GitHub Actions: removed file filter for tools, switched to golangci/golangci-lint-action@v6 with version v1.64.5, adjusted timeout to 10m, and modified cache paths.
CONTRIBUTING.md, README.md, docs/index.md Added documentation update instructions in CONTRIBUTING; updated Go version requirement in README; refined provider description and authentication instructions in docs.
Makefile Introduced GOLANGCI_LINT_VERSION variable; updated lint target to run in a Docker container; simplified release-build target; modified docs generation command.
fwprovider/test/*, fwprovider/types/*, proxmox/api/client_test.go, utils/io_test.go Replaced context.Background()/context.TODO() with t.Context() in tests; removed unused context imports where applicable.
go.mod Upgraded Go version from 1.23.0 to 1.24.0, added a tfplugindocs tool, and introduced/updated several dependencies.
main.go Added multiple //go:generate directives for formatting Terraform code and generating Terraform documentation, including file copying for migrated documentation.
tools/go.mod, tools/tools.go Removed the entire tools module files responsible for managing tool dependencies and documentation generation.

Possibly related PRs

Suggested labels

size/M

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 golangci-lint (1.62.2)

Error: can't load config: the Go language version (go1.23) used to build golangci-lint is lower than the targeted Go version (1.24.0)
Failed executing command with error: can't load config: the Go language version (go1.23) used to build golangci-lint is lower than the targeted Go version (1.24.0)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e013e54 and 8ef1935.

⛔ Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • tools/go.sum is excluded by !**/*.sum
📒 Files selected for processing (17)
  • .github/renovate.json5 (0 hunks)
  • .github/workflows/golangci-lint.yml (1 hunks)
  • CONTRIBUTING.md (1 hunks)
  • Makefile (2 hunks)
  • README.md (1 hunks)
  • docs/index.md (1 hunks)
  • fwprovider/test/test_environment.go (1 hunks)
  • fwprovider/types/hardwaremapping/path_test.go (1 hunks)
  • fwprovider/types/ip_addr_test.go (2 hunks)
  • fwprovider/types/ip_cidr_test.go (2 hunks)
  • fwprovider/types/nodes/apt/standard_repo_handle_test.go (1 hunks)
  • go.mod (3 hunks)
  • main.go (1 hunks)
  • proxmox/api/client_test.go (1 hunks)
  • tools/go.mod (0 hunks)
  • tools/tools.go (0 hunks)
  • utils/io_test.go (1 hunks)
💤 Files with no reviewable changes (3)
  • tools/go.mod
  • tools/tools.go
  • .github/renovate.json5
✅ Files skipped from review due to trivial changes (1)
  • main.go
🔇 Additional comments (17)
.github/workflows/golangci-lint.yml (1)

41-45: Update golangci-lint action configuration

The linter step now leverages golangci/golangci-lint-action@v6 with an explicit version (v1.64.5) and an extended timeout (10m). This change simplifies the previous direct command execution and aligns with the new dependency management. Please verify that the increased timeout is sufficient for larger projects and that any caching strategy changes (e.g. removal of tools/go.sum) do not impact performance.

Makefile (4)

6-8: Define consistent golangci-lint version variable

A new variable GOLANGCI_LINT_VERSION has been introduced with the value v1.64.5 to standardize the version used for linting. This promotes consistency between the GitHub Actions workflow and local builds.


115-115: Containerized linting command update

The lint target now runs golangci-lint inside a Docker container with the --fix flag enabled, mounting a cache directory that is tied to $(GOLANGCI_LINT_VERSION). Double-check that the cache directory mapping (~/.cache/golangci-lint/$(GOLANGCI_LINT_VERSION)) is appropriate for your project’s CI environment.


118-119: Simplified release build command

The release-build target has been streamlined by invoking goreleaser build --clean --skip=validate directly. While this simplifies the command, please ensure that skipping the validation step does not bypass any critical checks during release builds.


124-124: Refined documentation generation command

The docs target now runs go generate main.go, reflecting the migration of documentation generation from the old tools/ directory into the main source. Please confirm that the //go:generate directives in main.go are correctly configured to produce the intended documentation output.

go.mod (2)

3-5: Upgrade Go version and add tfplugindocs tool

The module now requires Go 1.24.0 and adds the github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs tool dependency. This update ensures that both the build environment and documentation generation are aligned with the latest requirements.


32-105: Comprehensive dependency updates

The indirect dependencies have been updated and several new ones have been added, which should improve functionality and compatibility with Go 1.24. Please review these updates carefully to ensure that none of the new versions introduce compatibility issues with existing code.

README.md (1)

31-32: Updated Go version requirement in documentation

The required Go version has been updated from 1.23 to 1.24 in the README, which now aligns with the updated go.mod. This change helps prevent any build version mismatches for contributors.

CONTRIBUTING.md (1)

45-50: Added documentation update instructions

A new section now instructs contributors to run make docs to regenerate documentation from the source code. This update supports the changes made in the Makefile and main.go, ensuring that documentation remains current with code changes.

docs/index.md (1)

8-8: Dual Support Update and Provider Description Clarification

The updated description now emphasizes that the provider supports both Terraform and OpenTofu while clearly stating that it interacts with resources supported by Proxmox VE. This update enhances clarity and ensures that users immediately understand the expanded scope of the provider.

utils/io_test.go (1)

19-19: LGTM! Good use of testing context.

Using t.Context() instead of context.Background() provides better integration with the testing framework, as the context is automatically canceled when the test completes.

fwprovider/types/hardwaremapping/path_test.go (1)

54-55: LGTM! Good use of testing context.

Using t.Context() instead of context.TODO() provides better integration with the testing framework and ensures proper cleanup.

proxmox/api/client_test.go (1)

87-87:

✅ Verification successful

LGTM! Good use of testing context.

Using t.Context() instead of context.Background() provides better integration with the testing framework and ensures proper cleanup.

Let's verify Go 1.24 compatibility since this PR includes a Go version upgrade:


🏁 Script executed:

#!/bin/bash
# Description: Check Go version and verify t.Context() usage is supported

# Check Go version in go.mod
echo "Checking Go version in go.mod:"
grep -E "^go [0-9]+\.[0-9]+" go.mod

# Verify all test files using t.Context()
echo -e "\nVerifying t.Context() usage in test files:"
rg -l "t\.Context\(\)" --type go --type-add "go:*.go"

Length of output: 523


Compatibility and Testing Context Verified

The PR correctly uses t.Context() for testing, and our verification confirms that:

  • The go.mod file specifies Go version 1.24.0.
  • All test files, including proxmox/api/client_test.go, correctly use t.Context() across the codebase.

No issues remain, and the code is good to merge.

fwprovider/types/ip_addr_test.go (1)

54-55: LGTM! Good use of testing context.

Using t.Context() instead of context.TODO() provides better integration with the testing framework and ensures proper cleanup.

Also applies to: 107-108

fwprovider/types/ip_cidr_test.go (1)

54-54: Great improvement in context management!

Using t.Context() instead of context.TODO() is a better practice as it:

  • Automatically cancels when the test completes
  • Integrates better with the testing framework's timeout and cancellation mechanisms

Also applies to: 115-115

fwprovider/types/nodes/apt/standard_repo_handle_test.go (1)

105-105: LGTM!

The change to use t.Context() aligns with best practices for test context management.

fwprovider/test/test_environment.go (1)

267-267: Excellent improvement in test environment setup!

Using t.Context() instead of context.Background() ensures proper cleanup of provider servers when tests complete and maintains consistency with the testing framework's lifecycle.

Also applies to: 271-271

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@bpg bpg merged commit 8ed271b into main Feb 24, 2025
8 checks passed
@bpg bpg deleted the go-1.24-cleanup-tools-dependencies branch February 24, 2025 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant