Crates.io | gos |
lib.rs | gos |
version | 0.1.4 |
source | src |
created_at | 2023-12-31 11:45:23.596629 |
updated_at | 2024-05-22 14:37:32.731942 |
description | gos is a Rust project that helps you create a Go project with the modules you specify in a config file. It automatically writes the import statements in the main.go file and runs go mod init and go mod tidy for you. |
homepage | https://github.com/limitcool/gos |
repository | https://github.com/limitcool/gos |
max_upload_size | |
id | 1084744 |
size | 100,992 |
gos is a tool written in Rust that helps you quickly create a Go project by specifying the Go modules you want to use in a config file. It automatically writes the import statements in the main.go file and runs go mod init and go mod tidy for you, initializing and updating your module dependencies.
To install gos, you need to have Rust and Cargo installed on your system. You can follow the instructions here to install them.
Then, you can use Cargo to install gos from crates.io:
cargo install gos
Or, you can also clone this repository and build it from source:
git clone https://github.com/limitcool/gos.git
cd gos
cargo build --release
The executable file will be located in the target/release
directory.
The first time you run gos, it will create a config file named config.yaml
in the current directory, where you need to fill in the Go modules you want to use. The config file has the following format:
# The Go modules you want to use
Mods: ["github.com/charmbracelet/log"]
# Whether to automatically create Vscode launch.json
CreateVscodeLaunch: true
You can specify any modules you want, as long as they are valid Go modules.
Then, you can run gos in the same directory to create a Go project:
gos new <project_name>
This will create a Go project with the name and modules you specified in the config file. It will also generate a main.go
file with the import statements and a simple main
function. For example, for the above config file, the main.go
file might look like this:
package main
import (
"github.com/charmbracelet/log"
)
func main() {
log.Info("gos")
}
gos is licensed under the GPL license.