• Stars
    star
    663
  • Rank 67,991 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created about 9 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

😼 The madness vendoring utility for Golang programs

MANUL Build Status License Go Report Card

madness

Manul is a vendoring utility for Go programs.

Installation

manul can be obtained using go get:

go get github.com/kovetskiy/manul

Packages are also available for Ubuntu/Debian and Arch Linux.

What's the reason for yet another utility?

Because all other vendor utilities suffer from the following:

  • Some wrap the go binary and spoof the GOPATH env variable. You will have a non-go-gettable project which needs additional software in order to compile and run;

  • Some copy the source code of dependencies into the vendor directory:

    • It will be nearly impossible to find anything using GitHub Search, because you will get many false-positive results;
    • Updating dependencies will require manual intervention and committing a lot of modified lines straight into the main repo;
    • You will not be able to tell what version of dependency your project is using will by looking at repository; you have to keep versions in the additional ambiguous file with vendors associated with commits.
  • Various architecture problems:

    • Impossible to update all or specific vendored dependencies;
    • Impossible to rollback vendored dependencies to specific version;
    • Impossible to remove unused vendored dependencies;
    • Impossible to lock version of vendored dependency.

Solution

We all love git, it's a very powerful instrument. Why don't we use its power for vendoring dependencies using an awesome feature, which is called git submodule?

With git submodule you will have a git repository for each dependency. They can be managed in the same way as main project by git.

Pros:

  • No need for additional software for building/running your Go project;

  • No need for additional JSON/TOML/YAML file for storing dependencies;

  • Update vendored dependencies directly from remote origins;

  • Rollback changes in dependencies;

  • Go-gettable

git submodule might look like a Silver Bullet, but it's still clumsy to work with manually. We want to have a powerful yet simple interface for vendoring dependencies using this technology.

manul can do it for us.

Usage

Who needs a documentation when there are GIFs?

First of all, we should request dependencies which we have in our project. To do this, just run manul with -Q (query) flag. It will output all the project imports (dependencies), like this:

first query

For example, we have six dependencies, let's lock versions of critical dependencies by adding submodules: in our case it's zhash and blackfriday packages.

For locking versions (installing dependencies) we should use -I (install) flag and specify dependencies, which we wish to install:

install two dependencies

After installation we can have a look for vendored and non-vendored dependencies by using flag -Q. After previous step we should see git commits along with two already vendored dependencies (zhash and blackfriday):

query after install

Let's install submodules for remaining dependencies, go the limit! Just run manul with flag -I without specifying any dependencies, manul will install all detected dependencies with skipping already vendored:

install all dependencies

Wow, that was crazy! Now, to update some vendored dependencies, for example, docopt-go package, manul should be invoked with the flag -U and import path (github.com/docopt/docopt-go):

update docopt

manul can be used to remove specified submodules of vendored dependencies by using -R (remove) flag and specifying dependencies import path:

removing

By the way, manul can detect and remove unused vendored dependencies using -C (clean) flag:

unused dependencies

manul can also get you a specific version of a dependency by using a commit-ish, for example:

  • manul -I golang.org/x/foo=34a235h1 will install foo at the specified commit
  • manul -U github.com/x/bar=this-tag will update it to this-tag version.

Let's summarize:

  • -I [<dependency>...] - install git submodules for specified/all dependencies;
  • -U [<dependency>...] - update specified/all already vendored dependencies;
  • -R [<dependency>...] - remove git submodules for specified/all dependencies;
  • -Q [<dependency>...] - list all used dependencies;
  • -C - detect and remove all git submodules for unused vendored dependencies.

You can see similar help message by passing -h or --help flag.

More Repositories

1

mark

Sync your markdown files with Confluence pages.
Go
867
star
2

go-fast

Compile Go programs 7x faster
Shell
367
star
3

zabbixctl

Most effective way for operating in Zabbix Server
Go
137
star
4

spin

The universal progress indicator
Go
64
star
5

loverage

Let your tests describe your program behavior
Go
62
star
6

sxhkd-vim

Vim plugin for sxhkd (Simple X hotkey daemon)
Vim Script
39
star
7

ko

golang package for working with configs in any format
Go
39
star
8

dotfiles

an effective environment based on arch linux w/ i3, vim, alacritty, zsh, polybar
Shell
26
star
9

curlbash

Poe's Law real life demonstration.
Shell
23
star
10

scut

Get satisfaction with servers for your configs.
Go
18
star
11

yota

yota.ru client written in Go
Go
15
star
12

poke

Convert MySQL slow log entries into JSON structured data.
Go
13
star
13

next-indentation

we need to go deeper
Python
10
star
14

github-watchers

list watchers of all your projects in github.com
Go
10
star
15

i3gator

i3 layout manager 🐊
Go
8
star
16

jsql

Make SQL query into JSON dataset
Go
7
star
17

coc-java-lombok

TypeScript
6
star
18

go-yota

golang and yota.ru
Go
6
star
19

i3-battery-nagbar

battery nagbar for i3 window manager
Go
6
star
20

lorg

Easily-customizable Go logger
Go
6
star
21

ankictl

Command line interface for ankiweb.net (flash cards)
Go
5
star
22

prols

A program for sorting a list of files based on a list of rules
Go
5
star
23

vim-autoresize

The dead-simple autoresize plugin for Vim.
Vim Script
5
star
24

aurora

AUR automatic package builder
Go
5
star
25

stacket

Command line interface for managing Bitbucket repositories & projects
Go
5
star
26

xoal

TypeScript
4
star
27

opsec

My security articles/conferences/cheatsheets base
4
star
28

mcabber-external-editor

mcabber and external editor
C
4
star
29

nucleus

Go
4
star
30

transline

Translate word or phrase using Yandex Services.
Go
4
star
31

neovim-move

:Move files with NeoVim
Python
4
star
32

glod

Key-value storage with bindings to processes.
Go
3
star
33

blankd

Go
3
star
34

layout

find a sweet spot for hotkey bindings
Go
3
star
35

timeprefix

Go
3
star
36

volumectl

Command line interface for controlling volume level in PulseAudio.
Go
3
star
37

sqltest

The missing tool for simple testing of SQL queries.
Go
3
star
38

vim-bash

Vim as Bash IDE
Vim Script
2
star
39

uroboros

Go
2
star
40

bruv

git show difference between branches of remote repositories
Go
2
star
41

biscuitjar

wrapper for cookiejar with write and read functionality
Go
2
star
42

zsh-fastcd

Do you like speed?
Shell
2
star
43

lojban

Go
2
star
44

poe

Shell
2
star
45

spinner-go

Go
2
star
46

blocksearch

Go
2
star
47

urxvt-fifo

urxvt fifo perl extension
Perl
2
star
48

vim-empty-lines

Manipulate empty lines with vim.
Vim Script
2
star
49

vim-ski

Vim Script
2
star
50

mcabber-focus

focus pocus hokus!
C
2
star
51

aight

Go
2
star
52

sink

Two way simple synchronizer with git and inotify.
Go
1
star
53

pa-switch-profile

Quick switcher for PulseAudio card profiles 🚀
Go
1
star
54

bee

Go
1
star
55

vim-list-mappings

Vim Script
1
star
56

go-backconnect

Go
1
star
57

go-vk

Simple vk.com Api written in Go
Go
1
star
58

zsh-smart-ssh

Shell
1
star
59

satori

Go
1
star
60

sirena

JavaScript
1
star
61

discord-wipe

Go
1
star
62

zsh-quotes

Shell
1
star
63

i3-room

Go
1
star
64

vim-hacks

Vim Script
1
star
65

mpstress

Go
1
star
66

eyed

gateway server for pam_eye module
Go
1
star
67

ycm-sh

Enhanced (improved) sh and bash syntax identifiers regexp for YouCompleteMe (vim plugin)
Python
1
star
68

pkgbuild-go

Go
1
star
69

favor

Go
1
star
70

zsh-add-params

Do not forget about the arguments!
Shell
1
star
71

zabbix-helper

JavaScript
1
star
72

athame-zsh-pkgbuild

pkgbuild for athame with zsh
Shell
1
star
73

short

short term memory tester
Go
1
star
74

gosharedlibrary

c go rpc playground
C
1
star
75

pkgbuilds

My collection of PKGBUILDs for Arch Linux User Packages.
Shell
1
star
76

jira-scripts

jira cli scripts
Ruby
1
star