version

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: Apache-2.0

Copyright © 2023 The listen.dev team <engineering@garnet.ai>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright © 2023 The listen.dev team <engineering@garnet.ai>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const ImportPath = "github.com/listendev/lstn"

ImportPath is the package import path for the lstn core.

Notice this identifier may be removed in the future.

View Source
const Unknown = "unknown"

Unknown is the version string lstn ends up having when the build does not have VCS info.

Variables

View Source
var VersionPrefix string

VersionPrefix is a string that overrides lstn's version.

It can be helpful when downstream packagers need to manually set the version. If no other version information is available, the short form version (see Get()) will be set to VersionPrefix, and the long version will include VersionPrefix at the beginning.

For example, set this variable during `go build` with `-ldflags`:

-ldflags '-X github.com/listendev/lstn/pkg/version.VersionPrefix=v1.0.0'.

Functions

func Changelog

func Changelog(version string) (string, error)

Types

type Version

type Version struct {
	Tag   string `json:"tag,omitempty"`
	Short string `json:"short,omitempty"`
	Long  string `json:"long,omitempty"`
}

func Get

func Get() Version

Version returns the lstn version.

This function is experimental.

Notice that lstn MUST be built with its `make/make` tool to properly embed complete version information.

This function follows the following logic:

  1. try to get version info from the build info provided by go.mod dependencies;
  2. try to get version info from the embedded VCS info (requires building from a git repository)
  3. when no version is available it returns unknown for both versions (short, long) if VersionPrefix is empty, otherwise it preprends both versions with it

See relevant Go issues: - https://github.com/golang/go/issues/29228 - https://github.com/golang/go/issues/50603

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL