mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-01 16:21:06 +00:00
Clarifying helper method usage
Changing comments and method signature
This commit is contained in:
parent
c5388d27c4
commit
d94100dee4
@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
// Compare only the relative path of two self links.
|
||||
func compareSelfLinkRelativePaths(k, old, new string, d *schema.ResourceData) bool {
|
||||
func compareSelfLinkRelativePaths(_, old, new string, _ *schema.ResourceData) bool {
|
||||
oldStripped, err := getRelativePath(old)
|
||||
if err != nil {
|
||||
return false
|
||||
@ -28,9 +28,11 @@ func compareSelfLinkRelativePaths(k, old, new string, d *schema.ResourceData) bo
|
||||
return false
|
||||
}
|
||||
|
||||
// compareSelfLinkOrResourceName checks if two resources are the same resource
|
||||
//
|
||||
// Use this method when the field accepts either a name or a self_link referencing a resource.
|
||||
// The value we store (i.e. `old` in this method), must be a self_link.
|
||||
func compareSelfLinkOrResourceName(k, old, new string, d *schema.ResourceData) bool {
|
||||
func compareSelfLinkOrResourceName(_, old, new string, _ *schema.ResourceData) bool {
|
||||
newParts := strings.Split(new, "/")
|
||||
|
||||
if len(newParts) == 1 {
|
||||
@ -42,7 +44,7 @@ func compareSelfLinkOrResourceName(k, old, new string, d *schema.ResourceData) b
|
||||
}
|
||||
|
||||
// The `new` string is a self_link
|
||||
return compareSelfLinkRelativePaths(k, old, new, d)
|
||||
return compareSelfLinkRelativePaths("", old, new, nil)
|
||||
}
|
||||
|
||||
// Hash the relative path of a self link.
|
||||
|
Loading…
Reference in New Issue
Block a user