gitgo

package module
v0.0.3-0...-3f894f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2025 License: MIT Imports: 7 Imported by: 0

README

GitGo

GitGo is a minimalist Go library and CLI toolset designed to automate Git workflows and Go module updates. It adheres to a zero-dependency policy, using only the Go standard library.

Features

  • Automated Workflows: Simplify Git push, tag, and release processes.
  • Go Module Management: Automate module versioning and dependency updates across projects.
  • Handlers: Use Git and Go handlers to build custom workflows.

Installation

go get github.com/cdvelop/gitgo

To install the CLI tools:

go install github.com/cdvelop/gitgo/cmd/push@latest
go install github.com/cdvelop/gitgo/cmd/gopu@latest

Usage

CLI

Push:

push "commit message" [tag]

Go Project Update (gopu):

gopu "commit message" [tag]
Library

GitGo provides Git and Go handlers for programmatic usage.

package main

import (
	"fmt"
	"log"

	"github.com/cdvelop/gitgo"
)

func main() {
	// Initialize Git handler
	git := gitgo.NewGit()

	// Execute Git Push Workflow
	summary, err := git.Push("feat: new feature", "v1.0.0")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(summary)

	// Initialize Go handler (depends on Git handler)
	goHandler := gitgo.NewGo(git)

	// Execute Go Project Update Workflow
	// (Verifies mod, runs tests, pushes, updates dependents)
	summary, err = goHandler.Push("fix: bug", "", false, false, "..")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(summary)
}

Workflows

Git Push
  1. git add .
  2. git commit -m "message"
  3. Generate or use provided tag.
  4. git push and git push origin <tag>.
Go Update (GoPU)
  1. go mod verify
  2. go test ./... (optional skip)
  3. go test -race ./... (optional skip)
  4. Execute Git Push workflow.
  5. Search for dependent modules in the specified path (default ..).
  6. Update dependents (go get -u module@version && go mod tidy).

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunCommand

func RunCommand(name string, args ...string) (string, error)

RunCommand executes a shell command It returns the output (trimmed) and an error if the command fails

func RunCommandSilent

func RunCommandSilent(name string, args ...string) (string, error)

RunCommandSilent executes a command (alias for RunCommand now, as RunCommand is also silent on success) kept for backward compatibility if needed, or we can remove it. The previous implementation was identical except for logging.

Types

type Git

type Git struct {
}

Git handler for Git operations

func NewGit

func NewGit() *Git

NewGit creates a new Git handler

func (*Git) GenerateNextTag

func (g *Git) GenerateNextTag() (string, error)

GenerateNextTag calculates the next semantic version

func (*Git) GetLatestTag

func (g *Git) GetLatestTag() (string, error)

GetLatestTag gets the latest tag

func (*Git) Push

func (g *Git) Push(message, tag string) (string, error)

Push executes the complete push workflow (add, commit, tag, push) Returns a summary of operations and error if any.

type Go

type Go struct {
	// contains filtered or unexported fields
}

Go handler for Go operations

func NewGo

func NewGo(gitHandler *Git) *Go

NewGo creates a new Go handler

func (*Go) Push

func (g *Go) Push(message, tag string, skipTests, skipRace bool, searchPath string) (string, error)

Push executes the complete workflow for Go projects Parameters:

message: Commit message
tag: Optional tag
skipTests: If true, skips tests
skipRace: If true, skips race tests
searchPath: Path to search for dependent modules (default: "..")

Directories

Path Synopsis
cmd
gopu command
push command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL