Tool for adding vanity imports URI to Go files.
e.g. package zipkin -> package zipkin // import "github.com/openzipkin/zipkin-go"
go install github.com/jcchavezs/porto/cmd/portoRun the tool and display the changes without applying them
porto path/to/libraryIf you want the changes to be applied to the files directly, run:
porto -w path/to/libraryIf you just want to list the files that porto would change vanity import, run:
porto -l path/to/libraryporto skips autogenerated, internal, third party and vendored files by default. You can customize what files get included using some flags:
- If you want to ignore files (e.g. proto generated files), pass the
--skip-filesflag:
porto --skip-files ".*\\.pb\\.go$" path/to/library- If you want to ignore directories (e.g. tooling directories), pass the
--skip-dirsflag:
porto --skip-dirs "^tools$" path/to/library- If you want to include
internalfolders and directories skipped by default:
porto --include-internal --skip-dirs-use-default=false path/to/library- If you want to restrict to certain files e.g.
doc.goyou can use:
porto --restrict-to-files "doc.go$" path/to/library