Git Product home page Git Product logo

govers's Introduction

The govers command searches all Go packages under the current directory for imports with a prefix matching a particular pattern, and changes them to another specified prefix. As with gofmt and gofix, there is no backup - you are expected to be using a version control system. It prints the names of any packages that are modified.

Usage:

govers [-d] [-m regexp] [-n] new-package-path

It accepts the following flags:

-d
	Suppress dependency checking
-m regexp
	Search for and change imports which have the
	given pattern as a prefix (see below for the default).
-n
	Don't make any changes; just perform checks.

If the pattern is not specified with the -m flag, it is derived from new-package-path and matches any prefix that is the same in all but version. A version is defined to be an element within a package path that matches the regular expression "(/|.)v[0-9.]+(-unstable)?".

The govers command will also check (unless the -d flag is given) that no (recursive) dependencies would be changed if the same govers command was run on them. If they would, govers will fail and do nothing.

For example, say a new version of the tomb package is released. The old import path was gopkg.in/tomb.v2, and we want to use the new verson, gopkg.in/tomb.v3. In the root of the source tree we want to change, we run:

govers gopkg.in/tomb.v3

This will change all gopkg.in/tomb.v2 imports to use v3. It will also check that all external packages that we're using are also using v3, making sure that our program is consistently using the same version throughout.

govers's People

Contributors

rogpeppe avatar

Watchers

James Cloos avatar Philippe Ombredanne avatar

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.