Skip to content

0.3.0

Compare
Choose a tag to compare
@svengreb svengreb released this 10 Dec 20:12
· 45 commits to main since this release
v0.3.0

Release Date: 2020-12-10 Project Board Milestone

Show all commits

This release version introduces a new task for the “github.com/markbates/pkger“ Go module command and updates for outdated dependencies.

Features

Task for “github.com/markbates/pkger“ Go module command#52#53 (⊶ 660601d)

↠ The github.com/markbates/pkger Go module provides the pkger command, a tool for embedding static files into Go binaries.

To configure and run the pkger command, a new task.GoModule has been implemented in a the pkger package that can be run using the gobin command runner or any other command runner that handles tasks of kind KindGoModule.

The task is customizable through the following functions:

  • WithEnv(env map[string]string) pkger.Option — sets the task specific environment.
  • WithExtraArgs(extraArgs ...string) pkger.Option — sets additional arguments to pass to the command.
  • WithIncludes(includes ...string) pkger.Option — adds the relative paths of files and directories that should be included.
    By default the paths will be detected by pkger itself when used within any of the packages of the target Go module.
  • WithModulePath(path string) pkger.Option — sets the module import path.
  • WithModuleVersion(version *semver.Version) pkger.Option — sets the module version.

The “elder“ reference implementation provides the new Pkger method including the handling of the “monorepo“ workaround.

Official “Static Assets Embedding“

Please note that the pkger project might be superseded and discontinued due to the official Go toolchain support for embedding static assets (files) that will most probably be released with Go version 1.16.

Please see the official draft document and markbates/pkger#114 for more details.

“Monorepo“ Workaround

pkger tries to mimic the Go standard library and the way how the Go toolchain handles modules, but is therefore also affected by its problems and edge cases.
When the pkger command is used from the root of a Go module repository, the directory where the go.mod file is located, and there is no valid Go source file, the command will fail because it internally uses the same logic like the list command of the Go toolchain (go list).
Therefore a “dummy“ Go source file may need to be created as a workaround. This is mostly only required for repositories that use a “monorepo“ layout where one or more main packages are placed in a subdirectory relative to the root directory, e.g. apps or cmd. For repositories where the root directory already has a Go package, that does not contain any build constraints/tags, or uses a “library“ layout, a “dummy“ file is probably not needed.
Please see markbates/pkger#109 and markbates/pkger#121 for more details.

The new Pkger method of the “elder“ reference implementation handles the creation of a temporary “dummy“ file that gets deleted automatically when the tasks finishes in order to avoid the need for the user to add such a file to the repository and commit it into the VCS.

Update outdated dependencies#47, #48

↠ Bumped outdated Go module dependencies to their latest versions:

  • #47 (⊶ 41e11b94) github.com/Masterminds/semver/v3 from 3.1.0 to 3.1.1 — Fixes an issue with generated regular expression operations.
  • #48 (⊶ 41e11b94) github.com/imdario/mergo from 0.3.9 to 0.3.11 — Includes a bunch of bug fixes that were pending, removes unused test code, reverts a faulty PR and announces a code freeze in preparation for a “cleanroom“ implementation with a new API in order to allow the codebase to be maintainable and clear again.

The full changelog is available in the repository


Copyright © 2019-present Sven Greb