Git Product home page Git Product logo

gex's Introduction

gex

CI GoDoc GitHub release (latest SemVer) Go Report Card License

The implementation of clarify best practice for tool dependencies.

See golang/go#25922 (comment)

Features

  • Manage versions of tools dependencies, and build them with specified version
  • Does not introduce new mechanisms to manage tool dependencies
  • Only 2 commands that you use: --add and --build
  • All you need to execute go generate ./tools.go if you want only to use tools

Usage

gex --add [packages...]

Add a new tool to dependencies:

$ gex --add github.com/golang/mock/mockgen

The tool will be managed in tools.go and its version will be managed by Modules or dep.

$ cat tools.go
// Code generated by github.com/izumin5210/gex. DO NOT EDIT.

// +build tools

package tools

// tool dependencies
import (
        _ "github.com/golang/mock/mockgen"
)

// If you want to use tools, please run the following command:
//  go generate ./tools.go
//
//go:generate go build -v -o=./bin/reviewdog github.com/golang/mock/mockgen

$ cat go.mod | grep mock
        github.com/golang/mock v1.1.1 // indirect

go generate ./tools.go

Build executable binaries into $PWD/bin.

$ go generate ./tools.go

gex [command] [args...]

Execute command that managed in tools.go and go.mod. gex will build the executable binary automatically if needed.

$ gex mockgen
# prints mockgen's help text...

Installation

macOS

$ brew install izumin5210/tools/gex

Other platforms

You can download prebuilt binaries for each platform in the releases page.

Build from source

$ go get github.com/izumin5210/gex/cmd/gex

Requirements

gex depends on dep or Modules to manage tool dependencies,

gex's People

Contributors

dependabot-preview[bot] avatar izumin5210 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gex's Issues

module-aware main command imports named awkwardly

Not 100% sure if this is specific to gex, or go modules binary tools more generally. If a tool has a top-level main binary and uses versioned module support, the naming pulls the version, not the library's name. For example:

gex --add https://github.com/maxbrunsfeld/counterfeiter/v6 adds https://github.com/maxbrunsfeld/counterfeiter as the binary v6. For subcommands they can be imported by their path, but since Counterfeiter's command is top-level - not nested under some name - that won't work reasonably.

In a non-module-aware context you can install counterfeiter as just https://github.com/maxbrunsfeld/counterfeiter without the v6 path, but trying to do gex --add https://github.com/maxbrunsfeld/counterfeiter/@v6.2.2 (for example) won't work because it is module aware - it says go.mod has post-v0 module path "github.com/maxbrunsfeld/counterfeiter/v6".

In any case, fully-namespanced versioned modules theoretically should support older and newer binaries coexisting; not sure if there's a good way to pull that one off.

Show warning when the adding package is not for command.

Now, gex can add packages which is not for command without any warnings.

# developers can add packages which is not for command
gex --add github.com/izumin5210/gex

# what developers really want to add
gex --add github.com/izumin5210/gex/cmd/gex

In this situation, developers cannot notice their mistake.
So, please implement to be able to show the warning.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.