Documentation ¶
Index ¶
- Constants
- func AddVToSemver(semverStr string) string
- func DefaultDataDirectory() string
- func DownloadBinary(downloadPath string, version string) (string, error)
- func DownloadBinaryForOS(downloadPath string, version string, desiredOS string) (string, error)
- func InitializeConfig(dataDirectory, version string) error
- func ResetConfig(dataDirectory string, keepBinaries bool, config *Config) error
- type Config
- func (c *Config) AddAlias(alias, version string) error
- func (c *Config) AddInstalledVersion(version, binPath string) error
- func (c Config) BinDirectory() string
- func (c Config) FindAlias(version string) string
- func (c *Config) NukeVersion(version string) error
- func (c *Config) RemoveAlias(alias string) error
- func (c *Config) RemoveInstalledVersion(version string) error
- func (c *Config) SetVersionUsing(version string) error
- func (c Config) SolvmAliasPath() string
- type SolcBinListResponse
- type SolcBuildEntry
Constants ¶
const ( DataDirectory string = ".solvm" DataDirectoryContextKey string = "DataDirectory" )
const ( BinDirectory string = "bin" ConfigFilename string = "config" AliasedSolc string = "solvm_solc" )
const (
DataDirectoryEnvKey string = "SOLVM_DATA_DIRECTORY"
)
Variables ¶
This section is empty.
Functions ¶
func AddVToSemver ¶
AddVToSemver literally just adds the "v" prefix to an otherwise "valid" semver string if it doesn't already have it.
func DefaultDataDirectory ¶
func DefaultDataDirectory() string
DefaultDataDirectory returns the full path to the default directory solvm uses to store configuration and data, which is $HOME/.solvm.
func DownloadBinary ¶
DownloadBinary downloads the solc binary with the specified version from the ethereum/solidity repo's releases. This function calls DownloadBinaryForOS using the output of runtime.GOOS.
func DownloadBinaryForOS ¶
DownloadBinaryForOS downloads the solc binary with the specified version and OS from the ethereum/solidity repo's releases. Valid values for desiredOS: "linux", "darwin", "macos", "windows". If successful, returns the path where the binary was downloaded.
func InitializeConfig ¶
Types ¶
type Config ¶
type Config struct { VersionUsing string `yaml:"version_using"` InstalledVersions map[string]string `yaml:"installed_versions,flow"` // version => binary filename Aliases map[string]string `yaml:"aliases,flow"` // alias => version // contains filtered or unexported fields }
Config contains solvm configuration data. By default, it's located at $HOME/.solvm/config
func LoadConfig ¶
func (*Config) AddInstalledVersion ¶
func (Config) BinDirectory ¶
func (*Config) NukeVersion ¶
func (*Config) RemoveAlias ¶
func (*Config) RemoveInstalledVersion ¶
func (*Config) SetVersionUsing ¶
func (Config) SolvmAliasPath ¶
type SolcBinListResponse ¶
type SolcBinListResponse struct { Builds []SolcBuildEntry `json:"builds"` Releases map[string]string `json:"releases"` // map in the format of version => path LatestRelease string `json:"latestRelease"` }
SolcBinListResponse is based on the response data from https://binaries.soliditylang.org/bin/list.json
func ListRemote ¶
func ListRemote() (*SolcBinListResponse, error)
ListRemote returns the response from https://binaries.soliditylang.org/bin/list.json, which contains all known/released versions of solc.
type SolcBuildEntry ¶
type SolcBuildEntry struct { Path string `json:"path"` Version string `json:"version"` // the "short" version identifier, ex. 0.7.6 Build string `json:"build"` // the git commit of this release LongVersion string `json:"longVersion"` // Version + Build Prerelease string `json:"prerelease"` Keccak256 string `json:"keccak256"` // Not sure if I'll end up using this... Sha256 string `json:"sha256"` Urls []string `json:"urls"` }
SolcBuildEntry is based on the "builds" field found in the response data from https://binaries.soliditylang.org/bin/list.json
func GetVersionFromUserInput ¶
func GetVersionFromUserInput(versionInput string, listResponse *SolcBinListResponse) *SolcBuildEntry
GetVersionFromUserInput basically takes anything a user could put in as a solc "version identifier", such as the release's commit number, short version, or the always-fun combo of both, and returns the relevant data from the /list.json api response. Or nil. nil works too.