diff --git a/sdk/go/common/resource/asset.go b/sdk/go/common/resource/asset.go index 7b3c03201d5c..8d4c38609d6b 100644 --- a/sdk/go/common/resource/asset.go +++ b/sdk/go/common/resource/asset.go @@ -351,11 +351,11 @@ func (a *Asset) readPath() (*Blob, error) { } func (a *Asset) readURI() (*Blob, error) { - url, isUrl, err := a.GetURIURL() + url, isURL, err := a.GetURIURL() if err != nil { return nil, err } - contract.Assertf(isUrl, "Expected a URI-based asset") + contract.Assertf(isURL, "Expected a URI-based asset") switch s := url.Scheme; s { case "http", "https": resp, err := httputil.GetWithRetry(url.String(), http.DefaultClient) @@ -885,11 +885,11 @@ func (a *Archive) readPath() (ArchiveReader, error) { func (a *Archive) readURI() (ArchiveReader, error) { // To read a URI-based archive, fetch the contents remotely and use the extension to pick the format to use. - url, isurl, err := a.GetURIURL() + url, isURL, err := a.GetURIURL() if err != nil { return nil, err } - contract.Assertf(isurl, "Expected a URI-based asset") + contract.Assertf(isURL, "Expected a URI-based asset") format := detectArchiveFormat(url.Path) if format == NotArchive { diff --git a/sdk/go/common/resource/config/key.go b/sdk/go/common/resource/config/key.go index 71b81289dd53..a7d287b9b84c 100644 --- a/sdk/go/common/resource/config/key.go +++ b/sdk/go/common/resource/config/key.go @@ -70,7 +70,7 @@ func (k *Key) Name() string { return k.name } -func (k *Key) MarshalJSON() ([]byte, error) { +func (k Key) MarshalJSON() ([]byte, error) { return json.Marshal(k.String()) } @@ -90,7 +90,7 @@ func (k *Key) UnmarshalJSON(b []byte) error { return nil } -func (k *Key) MarshalYAML() (interface{}, error) { +func (k Key) MarshalYAML() (interface{}, error) { return k.String(), nil } @@ -110,7 +110,7 @@ func (k *Key) UnmarshalYAML(unmarshal func(interface{}) error) error { return nil } -func (k *Key) String() string { +func (k Key) String() string { return k.namespace + ":" + k.name } diff --git a/sdk/go/common/resource/resource_id.go b/sdk/go/common/resource/resource_id.go index ee05299bcf78..29da8693c712 100644 --- a/sdk/go/common/resource/resource_id.go +++ b/sdk/go/common/resource/resource_id.go @@ -30,8 +30,8 @@ import ( type ID string // String converts a resource ID into a string. -func (id *ID) String() string { - return string(*id) +func (id ID) String() string { + return string(id) } // StringPtr converts an optional ID into an optional string. diff --git a/sdk/go/common/util/cmdutil/console.go b/sdk/go/common/util/cmdutil/console.go index 446fdbdc4023..ff77c06ed80f 100644 --- a/sdk/go/common/util/cmdutil/console.go +++ b/sdk/go/common/util/cmdutil/console.go @@ -152,7 +152,7 @@ func MeasureText(text string) int { return uniseg.GraphemeClusterCount(clean) } -func (table Table) ToStringWithGap(columnGap string) string { +func (table *Table) ToStringWithGap(columnGap string) string { columnCount := len(table.Headers) // Figure out the preferred column width for each column. It will be set to the max length of diff --git a/sdk/go/common/workspace/plugins.go b/sdk/go/common/workspace/plugins.go index 060938130be8..37f160f6ed5e 100644 --- a/sdk/go/common/workspace/plugins.go +++ b/sdk/go/common/workspace/plugins.go @@ -622,7 +622,7 @@ func (info *PluginInfo) Spec() PluginSpec { return PluginSpec{Name: info.Name, Kind: info.Kind, Version: info.Version} } -func (info *PluginInfo) String() string { +func (info PluginInfo) String() string { var version string if v := info.Version; v != nil { version = fmt.Sprintf("-%s", v) @@ -1094,11 +1094,12 @@ func (p dirPlugin) writeToDir(dstRoot string) error { }) } -// InstallWithContext installs a plugin's tarball into the cache. It validates that plugin names are in the expected format. -// Previous versions of Pulumi extracted the tarball to a temp directory first, and then renamed the temp directory -// to the final directory. The rename operation fails often enough on Windows due to aggressive virus scanners opening -// files in the temp directory. To address this, we now extract the tarball directly into the final directory, and use -// file locks to prevent concurrent installs. +// InstallWithContext installs a plugin's tarball into the cache. It validates that plugin names are in the expected +// format. Previous versions of Pulumi extracted the tarball to a temp directory first, and then renamed the temp +// directory to the final directory. The rename operation fails often enough on Windows due to aggressive virus scanners +// opening files in the temp directory. To address this, we now extract the tarball directly into the final directory, +// and use file locks to prevent concurrent installs. +// // Each plugin has its own file lock, with the same name as the plugin directory, with a `.lock` suffix. // During installation an empty file with a `.partial` suffix is created, indicating that installation is in-progress. // The `.partial` file is deleted when installation is complete, indicating that the plugin has finished installing. diff --git a/sdk/go/common/workspace/project.go b/sdk/go/common/workspace/project.go index 0970305f33ce..cfdd6e2c64be 100644 --- a/sdk/go/common/workspace/project.go +++ b/sdk/go/common/workspace/project.go @@ -348,7 +348,7 @@ func (info *ProjectRuntimeInfo) SetOption(key string, value interface{}) { info.options[key] = value } -func (info *ProjectRuntimeInfo) MarshalYAML() (interface{}, error) { +func (info ProjectRuntimeInfo) MarshalYAML() (interface{}, error) { if info.options == nil || len(info.options) == 0 { return info.name, nil } @@ -359,7 +359,7 @@ func (info *ProjectRuntimeInfo) MarshalYAML() (interface{}, error) { }, nil } -func (info *ProjectRuntimeInfo) MarshalJSON() ([]byte, error) { +func (info ProjectRuntimeInfo) MarshalJSON() ([]byte, error) { if info.options == nil || len(info.options) == 0 { return json.Marshal(info.name) }