Code Monkey home page Code Monkey logo

tainted's Introduction

Tainted

A tool to compare which go packages will need be to rebuilt as a result of changes between two git diffs.

Ideally used as part of a CI/CD pipeline to see which servies should be rebuilt and redeployed

N.B. Name inspired by terraforms taint terminology

Project status

I do not have time to update or maintain this package but fortunatly Digital ocean have a much better and activly maintained tool here which does what atinted does and more,

https://github.com/digitalocean/gta

https://www.digitalocean.com/blog/gta-detecting-affected-dependent-go-packages/

Requirments

  • git MUST be installed and be on the path where tainted is run

Install

From Go

go get -u github.com/kynrai/tainted

From binaries

see releases for latest binaries

Usage

Basic usage

From the go project repo e.g. $GOPATH/src/github.com/user/repo/

go list ./... | tainted

It using the standard go repo layout (recommended)

go list ./cmd/... | tainted

You can manually set the git commit ranges, by default the previous commit is checked with HEAD. i.e. HEAD~1..HEAD

You can change any or all of the params

go list ./... | tainted -from=HEAD~2

go list ./... | tainted -from=HEAD~1 -to=HEAD~1

tainted's People

Contributors

kynrai avatar tomparty 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

tainted's Issues

Thanks

I just wanted to say thanks for contributing this tainted package. Your library was easy to integrate and helped solve a pain point.

tainted not working with vendored modules

When running tainted using vendored modules, there is no way to specify the vendor folder to look for modules into.
Instead, it tries to download them again, eventually failing if some of them is private or unreachable.

This seems to be a limitation of the build module, and it's suggested to switch to the packages module to fix this.

Root package changes not being considered for tainting

Hey, thanks for making this tool, I ran into a little snag:

If I have the following structure:

cmd/
    app1/
        main.go     <- imports package project
    app2/
         main.go
project.go          <-  package name:  project

and I make changes to project.go, app1 and app2 are not considered to be tainted. project.go is in the CWD, but seems to be ignored here

When I change the code to the following:

if dir := filepath.Dir(scanner.Text()); dir != "." {
	changedDirs[dir] = struct{}{}
} else {
	ctx := build.Default
	cwd, err := os.Getwd()
	if err != nil {
		log.Fatal(err)
	}
	p, err := ctx.ImportDir(cwd, build.FindOnly)
	if err != nil {
		log.Fatal(err)
	}
	changedDirs[p.ImportPath] = struct{}{}
}

I seem to get my desired outcome. I'm not sure if this the best way to handle this or not and was wondering what your thoughts are about this matter.

Thanks,

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.