Skip to content

v0.3.0: a module for each platform

Choose a tag to compare

@kenshaw kenshaw released this 13 Oct 22:45
· 44 commits to main since this release

Each platform is now a Go module of its own. A build downloads the archives of your platform and no other.

What changed

  • Each target is a module in libmagic/<goos>_<goarch>/, such as github.com/xo/magic/libmagic/linux_amd64/v5. The root module imports the module of your platform and holds no archives. The root module is now about 12 MB.
  • Before this release, every user downloaded the archives of every platform. After it, a go build downloads the root module and one target module (6.7 to 9.6 MB). We tested this on linux/amd64 from an empty module cache.
  • go get and go mod tidy still fetch every target module once, because they read the imports for all platforms. The next build downloads one.
  • The import path github.com/xo/magic and the API do not change. Run go get github.com/xo/magic@v0.3.0.

New platforms

magic now builds the same platforms as resvg:

  • linux: amd64, arm64, arm (armv7)
  • darwin: amd64, arm64
  • windows: amd64, arm64
  • freebsd: amd64

The new targets are windows/arm64 and freebsd/amd64. The Linux archives are static and built for musl, so a program links them under glibc and under musl.

How well each platform is tested

  • The tests pass in CI on linux/amd64, linux/arm64, macOS arm64, windows/amd64 and windows/arm64. On windows/arm64, the C compiler is clang from llvm-mingw.
  • linux/arm passed under qemu on the build host, and has no CI job.
  • freebsd/amd64 links into a program. Nothing has run it, because GitHub has no hosted FreeBSD runner.
  • macOS amd64 has no CI result, because its CI job never gets a runner.

Versions

  • libmagic 5.48 (file 5.48)
  • zlib 1.3.2, bzip2 1.0.8, xz 5.8.4, zstd 1.5.7
  • libgnurx 2.5.1 on Windows, which is under LGPL 2.1

Tags

  • The root tag is v0.3.0.
  • Each target tag is the path of its folder and the version of file, such as libmagic/linux_amd64/v5.48.0.

The decisions are D16 to D19 in docs/PLAN.md.