github

package
Version: v0.0.0-...-f8bba77 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileGetter

type FileGetter func(path string) ([]byte, error)

FileGetter is a function that downloads the file from the provided path via raw.githubusercontent.com to avoid getting rate limited. It returns a nil error on 404. TODO: Rethink the 404 behavior?

func FileGetterFactory

func FileGetterFactory(org, repo, branch string, opts ...Opt) FileGetter

FileGetterFactory returns a GithubFileGetter that downloads files from raw.githubusercontent.com for the provided org/repo/branch It avoids getting ratelimited by using raw.githubusercontent.com. Because it is using a plain http client it can be heavily paralellized without killing the machine. It supports private repositories when configured WithAuthentication.

type Opt

type Opt func(*Opts)

func WithAuthentication

func WithAuthentication(username, token string) Opt

type Opts

type Opts struct {
	// The username to use for basic auth
	BasicAuthUser string
	// The token to use for basic auth
	BasicAuthPassword string
}

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL