# License stuff

**URL:** <https://ziggit.dev/t/license-stuff/15055>\
**Category:** Brainstorming\
**Created:** [April 19, 2026, 1:59pm UTC](https://ziggit.dev/t/license-stuff/15055 "2026-04-19T13:59:44Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericlang](https://ziggit.dev/user_avatar/ziggit.dev/ericlang/32/8515_2.png) [@ericlang](https://ziggit.dev/u/ericlang)\
**Post date:** [April 19, 2026, 1:59pm UTC](https://ziggit.dev/t/license-stuff/15055/1 "2026-04-19T13:59:44Z")

</div>

Dear programmers,

When I look at code, in 99% of the cases each file starts with a copy-pasted license.  
Instead each file should start with a short description what the file is for. Which is almost never there. So let’s **start** with a description and put the license downstairs 🙂

Best wishes, Eric

---

<div class="post-metadata">

**Author:** ![cryptocode](https://ziggit.dev/user_avatar/ziggit.dev/cryptocode/32/817_2.png) [@cryptocode](https://ziggit.dev/u/cryptocode)\
**Post date:** [April 19, 2026, 3:03pm UTC](https://ziggit.dev/t/license-stuff/15055/2 "2026-04-19T15:03:49Z")

</div>

> [@ericlang](#):
>
> So let’s **start** with a description and put the license downstairs 🙂

Or just put the license in a LICENSE file and don’t repeat it in each file at all. That’s what the vast majority of projects do these days, adding at most an SPDX-License-Identifier, though even that is rare.

---

<div class="post-metadata">

**Author:** ![Kass](https://ziggit.dev/user_avatar/ziggit.dev/kass/32/6557_2.png) [@Kass](https://ziggit.dev/u/Kass)\
**Post date:** [April 19, 2026, 6:46pm UTC](https://ziggit.dev/t/license-stuff/15055/3 "2026-04-19T18:46:42Z")

</div>

To slightly hijack the thread, what happened to the idea that imports might be better off relegated to the bottom of the file too? It’s Zig, so it’s fine for them to be at the very end.

```zig
fn main(init: std.process.Init) !void { ... }

...

const std = @import("std");
// dozen more imports

```

---

<div class="post-metadata">

**Author:** ![ericlang](https://ziggit.dev/user_avatar/ziggit.dev/ericlang/32/8515_2.png) [@ericlang](https://ziggit.dev/u/ericlang)\
**Post date:** [April 19, 2026, 6:52pm UTC](https://ziggit.dev/t/license-stuff/15055/4 "2026-04-19T18:52:58Z")

</div>

Nothing I guess.  
Still it feels a bit weird to do it.

---

<div class="post-metadata">

**Author:** ![pachde](https://ziggit.dev/user_avatar/ziggit.dev/pachde/32/2485_2.png) [@pachde](https://ziggit.dev/u/pachde)\
**Post date:** [April 19, 2026, 8:36pm UTC](https://ziggit.dev/t/license-stuff/15055/5 "2026-04-19T20:36:01Z")

</div>

Works. Some people do it, some people hate it. Personal preference.

---

<div class="post-metadata">

**Author:** ![spiffyk](https://ziggit.dev/user_avatar/ziggit.dev/spiffyk/32/7202_2.png) [@spiffyk](https://ziggit.dev/u/spiffyk)\
**Post date:** [April 20, 2026, 8:38am UTC](https://ziggit.dev/t/license-stuff/15055/6 "2026-04-20T08:38:47Z")

</div>

I started doing it and I love it. My current ordering style is:

- struct fields
- public constants
- heap of all other decls (functions, types, public, private; intermixed based on “vibes” - I usually try to put related things close together)
- imports (including aliases like `const assert = std.debug.assert`; all sorted with `:sort -i`)

Ultimately, it doesn’t matter too much - you can either find stuff via ZLS, or if you don’t want/have that, an underrated property of Zig is that it is **very greppable** - you can just find things by searching for `const MyType`, `fn init`, etc.

* * *

EDIT: Back on topic, I personally don’t put license headers in my files, just a `LICENSE` file in the project root. Lately I’ve been thinking about putting the `SPDX-License-Identifier` thing in all files, but definitely not a whole big header like the GPL would prefer you to do.

---

<div class="post-metadata">

**Author:** ![chrboesch](https://ziggit.dev/user_avatar/ziggit.dev/chrboesch/32/438_2.png) [@chrboesch](https://ziggit.dev/u/chrboesch)\
**Post date:** [April 20, 2026, 11:26am UTC](https://ziggit.dev/t/license-stuff/15055/7 "2026-04-20T11:26:23Z")

</div>

I’m not a fan of that, as I’m a bit paranoid. Whenever I look at a project, the first thing I do is open zig.zon to understand what dependencies it contains. This can lead to me not even looking further into the actual source code because there are simply too many dependencies. Then, when I look at the modules, I always check the `@import` statement first to get a rough overview. But these are just my personal preferences after over 40 years of software development.

---

<div class="post-metadata">

**Author:** ![mnemnion](https://ziggit.dev/user_avatar/ziggit.dev/mnemnion/32/2478_2.png) [@mnemnion](https://ziggit.dev/u/mnemnion)\
**Post date:** [April 20, 2026, 4:17pm UTC](https://ziggit.dev/t/license-stuff/15055/8 "2026-04-20T16:17:21Z")

</div>

> [@Kass](#):
>
> To slightly hijack the thread, what happened to the idea that imports might be better off relegated to the bottom of the file too?

This is how I do it now, except for executables. I’m satisfied with it.

---

<div class="post-metadata">

**Author:** ![mnemnion](https://ziggit.dev/user_avatar/ziggit.dev/mnemnion/32/2478_2.png) [@mnemnion](https://ziggit.dev/u/mnemnion)\
**Post date:** [April 20, 2026, 4:19pm UTC](https://ziggit.dev/t/license-stuff/15055/9 "2026-04-20T16:19:04Z")

</div>

> [@spiffyk](#):
>
> Lately I’ve been thinking about putting the `SPDX-License-Identifier` thing in all files

I had an LLM look at the main codebases for finding spidy-ids last summer, and they’ll turn them up anywhere, not just at the top of a file.

It blithely insisted they would only find them at the top of the file until I had it check, btw. Don’t trust clankers.

---

<div class="post-metadata">

**Author:** ![castholm](https://ziggit.dev/user_avatar/ziggit.dev/castholm/32/1330_2.png) [@castholm](https://ziggit.dev/u/castholm)\
**Post date:** [April 21, 2026, 10:03am UTC](https://ziggit.dev/t/license-stuff/15055/10 "2026-04-21T10:03:14Z")

</div>

If all files in your project repository are covered by the same license (and copyright declaration, if applicable), then I agree that a LICENSE file is enough.

However, if your repository contains files with different license terms, like vendored headers and source files copied from other projects, then please consider declaring license information on a file-by-file basis using short machine-readable header comments like

```zig
// (c) 2026 John Doe
// SPDX-License-Identifier: MIT

```

or, alternatively, license declaration manifest files like [`REUSE.toml`](https://reuse.software/spec-3.3/#reusetoml). This makes it easier for downstream users of your project audit the licenses of their dependencies (for aspects like GPL compatibility) and helps them Do The Right Thing with regard to license text reproduction and attribution requirements when distributing binaries.

---

<div class="post-metadata">

**Author:** ![cryptocode](https://ziggit.dev/user_avatar/ziggit.dev/cryptocode/32/817_2.png) [@cryptocode](https://ziggit.dev/u/cryptocode)\
**Post date:** [April 21, 2026, 10:07am UTC](https://ziggit.dev/t/license-stuff/15055/11 "2026-04-21T10:07:44Z")

</div>

> [@castholm](#):
>
> However, if your repository contains files with different license terms, like vendored headers and source files copied from other projects, then please consider declaring license information on a file-by-file basis using short machine-readable header comments like

Yeah agree. It’s nice when you can grep for spdx identifiers in mixed license repos.
