Skip to content

Commit

Permalink
make checkmake go install-able
Browse files Browse the repository at this point in the history
this makes it so the project can be installed simply via `go install` to
conform with golang standards. The base checkmake.go is just a symlink
to the actual main binary in `cmd/checkmake` so we don't need to
maintain the same file in two locations.

There is one downside with using go install right now, which is that all
of the version information for `checkmake --version` will be missing as
it gets filled in by make on build. We might find a way to fix this in
the future but for now `make` or the prebuilt packages are the preferred
way of installing checkmake. And `go install` is the less nice version
to conform with standards and support easier usage from other tools.

fixes #19
  • Loading branch information
mrtazz committed Jul 28, 2017
1 parent b68a873 commit 2d3fb76
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions checkmake.go

4 comments on commit 2d3fb76

@Lucas-C
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly a go get github.com/mrtazz/checkmake now fails with package github.com/mrtazz/checkmake: read C:\Users\lucas_cimon\gohome\src\github.com\mrtazz\checkmake\checkmake.go: unexpected NUL in input

This is probably due to: https://stackoverflow.com/a/27369325/636849

@mrtazz
Copy link
Owner Author

@mrtazz mrtazz commented on 2d3fb76 Jul 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I only tested go install. I think renaming the symlink to main.go probably fixes it. Going to give it a try.

I just tried the go get and it works fine for me:

% go get github.com/mrtazz/checkmake
% go install github.com/mrtazz/checkmake
% file ~/bin/checkmake
/Users/mrtazz/bin/checkmake: Mach-O 64-bit executable x86_64

Is this something specifically about Windows or Linux?

@Lucas-C
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I tested it under Ubuntu, and the pre-commit hook now works perfectly well !
Many thanks

I'm going to investigate the issue with Cygwin

@Lucas-C
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the symbolic link does not work under WIndows.
Here is what I get in a Windows shell (not in Cygwin):

# go get github.com/mrtazz/checkmake
package github.com/mrtazz/checkmake:
gohome\src\github.com\mrtazz\checkmake\checkmake.go:1:1: expected 'package', found '.'

Could you simply copy that file ?
I know it means code duplication, but I doubt any symlink-based solution is going to work under WIndows.

Please sign in to comment.