diff --git a/.github/run-tests.sh b/.github/run-tests.sh index 0ea02c2..470b11e 100755 --- a/.github/run-tests.sh +++ b/.github/run-tests.sh @@ -1,9 +1,33 @@ #!/bin/bash -# Install tools to test our code-quality. -go get -u golang.org/x/lint/golint +# I don't even .. +go env -w GOFLAGS="-buildvcs=false" -# Failures cause aborts +# Install the tools we use to test our code-quality. +# +# Here we setup the tools to install only if the "CI" environmental variable +# is not empty. This is because locally I have them installed. +# +# NOTE: Github Actions always set CI=true +# +if [ -n "${CI}" ] ; then + go install golang.org/x/lint/golint@latest + go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest + go install honnef.co/go/tools/cmd/staticcheck@latest +fi + +# Run the static-check tool +t=$(mktemp) +staticcheck -checks all ./... | grep -v "is deprecated"> "$t" +if [ -s "$t" ]; then + echo "Found errors via 'staticcheck'" + cat "$t" + rm "$t" + exit 1 +fi +rm "$t" + +# At this point failures cause aborts set -e # Run the linter @@ -11,8 +35,7 @@ echo "Launching linter .." golint -set_exit_status ./... echo "Completed linter .." -# Run the vet-checker. -echo "Launching go vet check .." -go vet ./... -echo "Completed go vet check .." - +# Run the shadow-checker +echo "Launching shadowed-variable check .." +go vet -vettool="$(which shadow)" ./... +echo "Completed shadowed-variable check .." diff --git a/README.md b/README.md index b69de77..4e452ef 100644 --- a/README.md +++ b/README.md @@ -1,63 +1,3 @@ - -# Contents - -* [github2mr](#github2mr) - * [Brief mr Example](#brief-mr-example) -* [Installation](#installation) -* [Configuration / Usage](#configuration--usage) - * [Other Git Hosts](#other-git-hosts) -* [Github Setup](#github-setup) - - - - -# github2mr - -Many [Github](https://github.com/) users have a large number of repositories upon which they work, and managing them all can sometimes be difficult. - -One excellent tool which helps a lot is the [myrepos](https://myrepos.branchable.com/) package, containing a binary named `mr`, which allows you to run many operations upon multiple repositories with one command. (It understands git, mercurial, darcs, cvs, and many other types of revision-control systems.) - -This repository contains a simple command-line client which allows you to easily generate a configuration file containing __all__ your github repositories fetching them via the [Github API](https://developer.github.com/v3/) with various filtering and limiting options. - -The end result of using `mr` and `github2mr` is that you should be able to clone all your remote github repositories, and update them easily with only a couple of commands which is great for when you work/develop/live on multiple machines. - - -## Brief `mr` Example - -Let us pretend I'm moving to a new machine; first of all I export the list of all my remote repositories to a configuration file using _this_ tool: - - github2mr > ~/Repos/.mrconfig.github - -* **NOTE**: The first time you create a new configuration file you will need to mark it as being trusted, because it is possible for configuration files to contain arbitrary shell-commands. - * Mark the configuration file as trusted by adding it's name to `~/.mrtrust`: - * `echo ~/Repos/.mrconfig.github >> ~/.mrtrust` - -Now that we've populated a configuration-file we can tell `mr` to checkout each of those repositories: - - mr --jobs 8 --config ~/Repos/.mrconfig.github - -Later in the week I can update all the repositories which have been cloned, pulling in any remote changes that have been made from other systems: - - mr --jobs 8 --config ~/Repos/.mrconfig.github update - -**NOTE**: If you prefer you can just use `update` all the time, `mr` will checkout a repository if it is missing as part of the `update` process. I'm using distinct flags here for clarity. Please read the `mr`-manpage to look at the commands it understands. - - -# Installation - -You should be able to install this application using the standard golang approach. For `go>=1.13` go modules must be enabled: - - $ GO111MODULE=on go get github.com/skx/github2mr - -For earlier versions: - - $ go get github.com/skx/github2mr - -If you prefer you can [download the latest binary](http://github.com/skx/github2mr/releases) release, for various systems. - - - - # Configuration / Usage Once installed you'll need to configure your github token, which you can generate from [withing your github settings](https://github.com/settings/tokens).