from Hacker News

GoLic, injects license into source code files

by kure256 on 10/26/24, 9:33 AM with 25 comments

  • by gtirloni on 10/28/24, 4:23 PM

    I've opted to simply add the SPDX license identifier [0] , just like it's done in the Linux kernel [1]

    [0] https://spdx.org/licenses/

    [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...

  • by jchw on 10/28/24, 2:58 PM

    Neat. There's a lot of hand rolled implementations of this idea, would be nice to have something to standardize on. I am sure it can be done with custom templates but a good idea IMO might be supporting declarations using SPDX IDs. You see them in some source code, e.g. KDE source code. More info here:

    https://spdx.dev/learn/handling-license-info/

    For anyone wondering if this (license information in source files) is necessary, I think the answer is "maybe". Some licenses (e.g. Apache 2) seem to be written such that the license itself requires the disclaimer, and even having copyright information (e.g. users that make substantial contribution adding the name of whoever is assigned the copyright for their contribution to the header) is a good idea. I used to be against this for aesthetic reasons, viewing it somewhat similarly to those annoying corporate email footers, but over time it's become more obvious to me that it not only is great for keeping the license very explicit everywhere but may also be legally a good idea. (IANAL.)

  • by Ferret7446 on 10/29/24, 12:00 AM

    This could be done with a shell one-liner IIUC.

    Aside: what is with the contemporary obsession with injecting emojis into everything? If I wanted a picture book, well, I'd go read a picture book.

  • by JamesCoyne on 10/28/24, 3:56 PM

    Could use a (2021) in the title. No activity since then in the repo
  • by dangoor on 10/28/24, 5:33 PM

    Ideally, this would follow the format of reuse.software so that there's a machine-readable standard for these: https://reuse.software

    I'm working on tooling that involves automated reading of this info, and it's a lot easier if the tools don't have to do fuzzier matching.

  • by zoezoezoezoe on 10/30/24, 2:05 PM

    I like this idea, but with a project with two or more source code files, I would prefer an SPDX identifier, or just rely on the license file in the project directory, licenses at the top of sources IMO should only be for single file/header libraries.
  • by IshKebab on 10/28/24, 4:12 PM

    There's no legal reason to do this.