Giter Club home page Giter Club logo

goup's Introduction

Go Up

GoDoc Build Status Code Coverage Go Report Card

goup checks if there are any updates for imports in your module. It parses go.mod files to get dependencies with their version, uses go-git to retrieve the list of remote tags and performs comparisons to advise to update if necessary. The main purpose is using it as a linter in continuous integration or in development process, but you can also use it to keep updated the go.mod files, see the -f option.

Features

  1. No dependency. Pure Go tool designed to be used as a linter. Zero call to go or git command line tools.
  2. As go.mod uses the semantic versioning for module version, goup does the same and provides 3 modes: major, major+minor and by default, path.
  3. Takes care of each part of a mod file: require, exclude and replace.
  4. Allows the capacity to force some modules to only use release tag, no prerelease.
  5. Manages one or more go.mod files, for example with ./... as parameter.
  6. As with go1.14, you can use the GOINSECURE environment variable to skip certificate validation and do not require an HTTPS connection. Since version v0.3.0, GOPRIVATE has the same behavior.
  7. Can amend on demand go.mod files with deprecated dependencies to update them.
  8. Since version v0.4.0, a colorized output in a TTY.
  9. Allows to fetch Go modules from private repositories using ~/.netrc file or NETRC environment variable (https://go.dev/doc/faq#git_https).

Demo

$ goup -v -m ./...
$ goup: github.com/rvflash/goup: golang.org/x/mod v0.2.1-0.20200121190230-accd165b1659 is up to date
$ goup: github.com/rvflash/goup: github.com/matryer/is v1.1.0 must be updated with v1.2.0
$ goup: github.com/rvflash/goup: github.com/golang/mock v1.4.0 is up to date
$ goup: github.com/rvflash/goup: gopkg.in/src-d/go-git.v4 v4.13.1 is up to date

Installation

It's important to have reproducible CI, so it's recommended to install a specific version of goup available on the releases page.

Go

GO111MODULE=on go get github.com/rvflash/[email protected]

Docker

docker run --rm -v $(pwd):/pkg rvflash/goup:latest goup -V

Usage

goup [flags] [modfiles]

The goup command checks updates of any dependencies in the go.mod file. It supports the following flags:

  • -M: ensures to have the latest major version. By default, only the path is challenged.
  • -m: ensures to have the latest couple major with minor version. By default, only the path is challenged.
  • -V: prints the version of the tool.
  • -f: force the update of the go.mod file as advised
  • -i: allows excluding indirect modules.
  • -r: it's a comma-separated list of glob patterns to match the repository paths where to force tag usage. For example with github.com/group/* as value, any modules in this repository group must have a release tag, no prerelease.
  • -s: forces the process to exit on first error occurred.
  • -t: defines the maximum time duration to perform the check. By default, 10s.
  • -v: verbose output

[modfiles] can be one or more direct path to go.mod files, . or ./... to get all those in the tree.

Using example with an auto-signed local git repository:

GOINSECURE="gitlab.example.lan/*/*" goup -v .

goup's People

Contributors

elgohr avatar rvflash 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

Watchers

 avatar  avatar  avatar

Forkers

mewbak heisonyee

goup's Issues

check failed: git: invalid repository: unsecured

for my repo I am getting following error

check failed: git: invalid repository: unsecured call to http://../ cancelled: failed to list tags

goup -v -m ./...

goup: github.com/xmlking/logger: github.com/pkg/errors v0.9.1 is up to date
goup: github.com/xmlking/logger: github.com/rs/zerolog v1.18.0 is up to date
goup: github.com/xmlking/logger: github.com/sirupsen/logrus v1.4.2 is up to date
goup: github.com/xmlking/logger/gormlog: ../ check failed: git: invalid repository: unsecured call to http://../ cancelled: failed to list tags
goup: github.com/xmlking/logger/logrus: ../ check failed: git: invalid repository: unsecured call to http://../ cancelled: failed to list tags
goup: github.com/xmlking/logger/logrus: github.com/sirupsen/logrus v1.4.2 is up to date
goup: github.com/xmlking/logger/logrus: github.com/pkg/errors v0.9.1 is up to date
goup: github.com/xmlking/logger/zap: ../ check failed: git: invalid repository: unsecured call to http://../ cancelled: failed to list tags
goup: github.com/xmlking/logger/zap: github.com/pkg/errors v0.9.1 is up to date
goup: github.com/xmlking/logger/zap: go.uber.org/zap check failed: git: invalid repository: unsecured call to http://go.uber.org/zap cancelled: failed to list tags
goup: github.com/xmlking/logger/zerolog: ../ check failed: git: invalid repository: unsecured call to http://../ cancelled: failed to list tags
goup: github.com/xmlking/logger/zerolog: github.com/pkg/errors v0.9.1 is up to date
goup: github.com/xmlking/logger/zerolog: github.com/rs/zerolog v1.18.0 is up to date

Consider submitting goup to golangci-lint

For linting, I typically use golangci-lint, a very powerful multi-linter tool. It would be nice if goup was able to be integrated with that tool. This may or may not require output changes to goup to be compatible, which is why I'm suggesting it as an issue on goup as opposed to golangci-lint.

goup doesn't respect GOPRIVATE

I was trying out goup today on a module that imports several private git repos. All the standard go commands work with my module and my GOPRIVATE settings. I explicitly set GOPRIVATE, and it appears that the go tooling set GONOPROXY and GONOSUMDB as well for me, as they all point to some private repos. I'm guessing that goup will need to read these env vars, as well as look at the .netrc file for credentials, as that is the recommended way to specify private git auth last I checked for go tools.

Switch to go-git/go-git

While investigating goup as a potential addition to our CI, I noticed that it uses src-d/go-git to discover available versions. As I was contemplating implementing something similar if I hadn't found goup, I was curious about this repository, but when I went to it, there was a notice at the top of its README saying that development had been moved to go-git/go-git. I would advise that goup should be updated to use the new go-git/go-git library.

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.