nishanths / license Goto Github PK
View Code? Open in Web Editor NEWCommand line license text generator.
License: MIT License
Command line license text generator.
License: MIT License
As of Go 1.16, the embed
package allows embedding arbitrary files into variables in code. I think that using this built in rather than depending on an external tool like go-bindata
is nicer and the code itself is much cleaner and easier to read.
The way that embed
works is by adding a directive comment with the target file's path above a variable declaration, such as a string or byte slice, and the compiler sets that variable to the contents of that file at build time. This is basically what we do now when we regenerate templates.go with go-bindata
, however, embed
has two main advantages over go-bindata
:
embed
is a part of the build. This makes it easier for new contributors as using go-bindata
wasn't really obvious to me when I was making my first contribution here.I've been meaning to add this since I read about embed
in the release notes so I'll probably make a prototype on my fork at some point. I just wanted to feel out if this would be wanted / if there are any design considerations to make.
Could you try to write a clone of your great project in Python please?
Hi,
When I use
license --name COLUNDRUM --year 2016 gpl-3.0
The output is the original license without customization about project title, name and year.
Same issue with
Thanks
The github.com/nishanths/license
uses Go modules and the current release version is v2
. And it’s module path is "github.com/nishanths/license"
, instead of "github.com/nishanths/license/v2"
. It must comply with the specification of "Releasing Modules for v2 or higher" available in the Modules documentation. Quoting the specification:
A package that has opted in to modules must include the major version in the import path to import any v2+ modules
To preserve import compatibility, the go command requires that modules with major version v2 or later use a module path with that major version as the final element. For example, version v2.0.0 of example.com/m must instead use module path example.com/m/v2.
https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher
GO111MODULE=on, run go get
targeting any version >= v2.0.0 of the nishanths/license
:
$ go get github.com/nishanths/[email protected]
go: finding github.com/nishanths/license v2.0.0
go: finding github.com/nishanths/license v2.0.0
go get github.com/nishanths/[email protected]: github.com/nishanths/[email protected]: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2
run go get github.com/nishanths/license
, the version will stuck in v1.0.0:
$go get github.com/nishanths/license
go: downloading github.com/nishanths/license v1.0.0
go: github.com/nishanths/license upgrade => v1.0.0
SO anyone using Go modules will not be able to easily use any newer version of nishanths/license
.
This would push them back to not being managed by Go modules (instead of incorrectly using Go modules).
Ensure compatibility for downstream module-aware projects and module-unaware projects projects
I see these dependencies in your go.mod file, which need modle awareness. So you'd better not use third-party tools(such as: Dep, glide, govendor…).
github.com/nishanths/license/v5
You also need to update the import path to:
import github.com/nishanths/license/…
Patch the go.mod
file to declare the module path as github.com/nishanths/license/v2
as per the specs. And adjust all internal imports.
The downstream projects might be negatively affected in their building if they are module-unaware (Go versions older than 1.9.7 and 1.10.3; Or use third-party dependency management tools, such as: Dep, glide,govendor…).
[*] You can see who will be affected here: [2 module-unaware users, i.e., PhoneSecurity2381/License-Agreement, jspc/mkrepo, ]
https://github.com/search?l=Go&p=2&q=nishanths%2Flicense&type=Code
If you don't want to break the above repos. This method can provides better backwards-compatibility.
Release a v2 or higher module through the major subdirectory strategy: Create a new v2 subdirectory
(github.com/nishanths/license/v2) and place a new go.mod file in that subdirectory. The module path
must end with /v2
. Copy or move the code into the v2 subdirectory. Update import statements
within the module to also use /v2
(import "github.com/nishanths/license/v2/…"). Tag the release with v2.x.y
.
Leave v2
as a dead version and bump to v3 with the path changes.
If the standard rule of go modules conflicts with your development mode. Or not intended to be used as a library and does not make any guarantees about the API. So you can’t comply with the specification of "Releasing Modules for v2 or higher" available in the Modules documentation.
Regardless, since it's against one of the design choices of Go, it'll be a bit of a hack. Instead of go get github.com/nishanths/license@version-tag
, module users need to use this following way to get the nishanths/license
:
(1) Search for the tag
you want (in browser)
(2) Get the commit hash
for the tag
you want
(3) Run go get github.com/nishanths/license@commit-hash
(4) Edit the go.mod file to put a comment about which version you actually used
This will make it difficult for module users to get and upgrade nishanths/license
.
You can make a choice to fix DM issues by balancing your own development schedules/mode against the affects on the downstream projects.
For this issue, Solution 1
can maximize your benefits and with minimal impacts to your downstream projects the ecosystem.
~
❯ license gpl-3.0
html/template:gpl-3.0.tmpl: "'" in attribute name: "program's name and a brief idea "
~
❯ license gpl-2.0
html/template:gpl-2.0.tmpl: "'" in attribute name: "program's name and a brief idea "
license package version: v1.0.1
go version: go 1.9.2
Hi there,
I was trying to install this package via Homebrew, and followed all the steps, however, on the last step where it actually installs the package, I got the following error:
==> Installing license from nishanths/tap
==> Downloading https://storage.googleapis.com/license-binaries/darwin_amd64/0.1.2/license.tar.gz
######################################################################## 100.0%
Error: Empty installation
Any ideas?
Firstly, the check auto-formats and auto-commits changes to branches. This is behavior I tend to not like. We should modify the check to only check that the code is formatted. It should not auto-commit any changes.
Secondly, it seems to fail when run on a PR for branches on other remotes. For example, see this run.
The README mentions the ISC license, although as far as I can see it was never supported.
I can open a PR to add it, or was there a reason it was removed?
When having /home and /tmp on separate partitions, I get:
rename /tmp/license-388690913 /home/jD91mZM2/.license: invalid cross-device link
This is because you can't rename across partitions. When renaming fails with this error you should fallback to copying and deleting the original.
As Markdown gives text-level semantics while being very subtle, it would be useful for licenses.
Hello,
When I use this command :
license -name "Alice L" -year 2013 gpl-3.0
The <name of author>
and <year>
fields remain empty.
Thanks in advance :)
I clone the repo then run:
cd license; go mod tidy; go build
which gives following error:
go: inconsistent vendoring in /Users/kendfss/gitclone/clones/nishanths/license:
github.com/onsi/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
To ignore the vendor directory, use -mod=readonly or -mod=mod.
To sync the vendor directory, run:
go mod vendor
And when I ignore (i just removed the vendor directory), it built and works normally.
I think since the readme recommends go install
and any version of go that supports install
supports modules, the vendor directory isn't useful anymore.
Would you be interested in providing pre-built binaries? I'm currently looking at bundling this tool in a few non-golang based Docker images, and having it pre-built would be really convenient.
If so, I might try and submit a PR w/ a GoReleaser + GH actions config.
$ go get github.com/nishanths/license
# github.com/nishanths/license/base
projects/golang/src/github.com/nishanths/license/base/config.go:24: undefined: os.LookupEnv
Running Debian Jessie with golang package version 2:1.3.3-1.
Installed through go install
on Debian Bookworm (testing) (go 1.17) and added ~/go/bin
to my PATH
via .bashrc
since this is my first time using the go install
system. When I tried to run it I got the following error:
$ license gpl-3.0 -o LICENCE.txt
rename /tmp/license-349994170 /home/[REDACTED]/.license: invalid cross-device link
The directory ~/.license doesn't exist, which seems like it may be an installation problem. If so, I may need a bit of help with installation instructions. If not, my system is partitioned with separate partitions for /
and /home
, so my guess is this may be the cause of the issue; that or problems with the /tmp
filesystem which resides in memory.
Position of the arguments can cause app to ignore arguments. If the arguments -o LICENSE
are placed after the license name then they are ignored.
I expected the following command when executed would output the license into the file LICENSE
.
license mit -o LICENSE
The license was outputted to stdout and the LICENSE
file was not written.
I'm on Linux kernel 5.4, running elementary OS 5.0, which is Ubuntu 18.04, amd64 architecture.
When I run the CLI, I get the following error:
$ license -o LICENSE-APACHE apache2
rename /tmp/license-247108171 /home/naftuli/.license: invalid cross-device link
/home/
and /tmp/
live on different filesystems. I assume that this issue is caused by trying to hard-link rather than by trying to create a new file and write data to it.
Please add the Free Art License 1.3.
$ license -name Alice -y 2017 apache-2.0
The output includes Copyright {yyyy} {name of copyright owner}
instead of filling in the supplied values.
When I run license -name dinhanhx -o LICENSE apache-2.0
, the LICENSE file doesn't get year and name updated.
I just build it from source at this commit 7234d01
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.