osversion

package module
v0.0.0-...-0f9d3c6 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

README

osversion

e2e test

This repo contains a minimal library for detecting the current Windows version at runtime.

It's based on similar code in Kubernetes, itself seemingly based on this StackOverflow answer, without requiring the large dependency on Kubernetes, and with end-to-end tests using GitHub Actions.

It has a single dependency on x/sys/windows/registry.

Its intended use is to be able to match OCI container image manifests with a platform value that specifies an os.version, so that the correct image can be selected, taking into account the Windows OS version.

Usage

import "github.com/imjasonh/osversion"

...
fmt.Printf("The current osversion is %q", osversion.Get())
...

When this package is used on Windows, osversion.Get returns a string like "10.0.17763", depending on the current Windows version.

If this package is used on any non-Windows OS, osversion.Get returns an empty string.

See end-to-end test config to see expected values for different Windows versions.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get() string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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