Skip to content

Nicconike/AutomatedGo

AutomatedGo🐿️

Release CodeQL Code Coverage Go Report Card codecov GitHub go.mod Go version GitHub Release Docker Image Size Docker Pulls Go Reference GitHub License wakatime Visitor Badge

AutomatedGo is a Go tool that automates the process of checking and updating Go versions in your projects. It can detect the current Go version from various file types, compare it with the latest available version, and download the newest version if an update is available.

Features

  • Detect current Go version from various file types (Dockerfile, go.mod, JSON configs, etc.)
  • Check for the latest available Go version
  • Download the latest Go version if an update is available
  • Checksum validation for downloaded Go versions to ensure integrity
  • Support for different operating systems and architectures

Installation

To add AutomatedGo in your Go project, use the following command:

go get -u github.com/Nicconike/AutomatedGo/v2

To install AutomatedGo as a Go binary, use the following command:

go install github.com/Nicconike/AutomatedGo/v2/cmd/[email protected]

Usage

Basic Usage

automatedgo -file <path-to-file> -os <target-os> -arch <target-arch>

This will check the specified file for the current Go version, compare it with the latest available version, and download the new version if an update is available.

Note

If you don't specify the os and arch type, the tool will download the latest version by detecting your current operating system and architecture.

Command-line Options

  • -file or -f: Path to the file containing the current Go version
  • -version or -v: Directly specify the current Go version
  • -os: Target operating system (windows, linux, macOS[darwin])
  • -arch: Target architecture (386[x86], amd64[x86-64], arm64, armv6l[armv6])

Examples

  1. Download latest version from Dockerfile:

    automatedgo -f Dockerfile

    Dockerfile Example

  2. Download latest version from go.mod:

    automatedgo -f go.mod

    Go Mod Example

  3. Download latest version by just specifying version directly as argument:

    automatedgo -v 1.18

    Direct Example

  4. Download latest version from JSON for a specific OS and architecture:

    automatedgo -f version.json -os linux -arch arm64

    JSON Example with OS

Also, checkout the example implementation for AutomatedGo at test-AutomatedGo repository.

Supported File Types

AutomatedGo can extract Go versions from various file types, including:

  • Dockerfile
  • go.mod
  • JSON configuration files
  • Plain text files with version information

The tool uses various regex patterns to detect Go versions, making it flexible for different project setups.

Missing any file types you expected to see? Let me know via discussions or discord server.

Contributing

Star⭐ and Fork🍴 the repo to support and start with your feature request(or bug) and experiment with the project to implement whatever new idea you might have and send the pull request through 🤙

Please refer Contributing.md to get to know how to contribute to this project. And thank you for considering to contribute.

License

GPLv3 License