util

package
v0.0.0-...-99c9ca1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ChromiumBase = "https://chromium.googlesource.com/chromium/src"
	ChromiumDeps = ChromiumBase + "/+/%s/DEPS"
	ChromiumURL  = ChromiumBase + "/+/%s/third_party/blink/public/devtools_protocol/browser_protocol.pdl"

	V8Base = "https://chromium.googlesource.com/v8/v8"
	V8URL  = V8Base + "/+/%s/include/js_protocol.pdl"

	// v8 <= 7.6.303.13 uses this path. left for posterity.
	V8URLOld = V8Base + "/+/%s/src/inspector/js_protocol.pdl"

	// chromium < 80.0.3978.0 uses this path. left for posterity.
	ChromiumURLOld = ChromiumBase + "/+/%s/third_party/blink/renderer/core/inspector/browser_protocol.pdl"
)

Variables

View Source
var Logf = log.Printf

Logf is a shared logging function.

View Source
var VerRE = regexp.MustCompile(`^[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?$`)

VerRE is a regular expression for matching version numbers.

Functions

func CompareSemver

func CompareSemver(a, b string) bool

CompareSemver returns true if the semver of a is less than the semver of b.

func Get

func Get(c Cache) ([]byte, error)

Get retrieves a file from disk or from the remote URL, optionally base64 decoding it and writing it to disk.

func GetDepVersion

func GetDepVersion(typ, ver string, deps, refs Cache) (string, error)

GetDepVersion version retrieves the v8 version used for the browser version.

func GetLatestVersion

func GetLatestVersion(index Cache) (string, error)

GetLatestVersion determines the latest tag version listed on the gitiles html page.

func GetRefs

func GetRefs(c Cache) (map[string]Ref, error)

GetRefs returns the refs for the url.

func MakeSemver

func MakeSemver(v string) *semver.Version

MakeSemver makes a semver for v.

Types

type Cache

type Cache struct {
	URL    string
	Path   string
	TTL    time.Duration
	Decode bool
}

Cache holds information about a cached file.

type Ref

type Ref struct {
	Value  string `json:"value"`
	Target string `json:"target"`
}

Ref wraps a ref.

Jump to

Keyboard shortcuts

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