Merge pull request #275 from gotestyourself/fs-add-godoc-links

fs: add go doc links
diff --git a/golden/golden.go b/golden/golden.go
index ce96ba1..1ba1c1c 100644
--- a/golden/golden.go
+++ b/golden/golden.go
@@ -6,7 +6,7 @@
 `go test pkgname -update`. To ensure the update is correct
 compare the diff of the old expected value to the new expected value.
 */
-package golden // import "gotest.tools/v3/golden"
+package golden
 
 import (
 	"bytes"
@@ -40,11 +40,19 @@
 // in the environment before running tests.
 //
 // The default value may change in a future major release.
+//
+// This does not affect the contents of the golden files themselves. And depending on the
+// git settings on your system (or in github action platform default like windows), the
+// golden files may contain CRLF line endings.  You can avoid this by setting the
+// .gitattributes file in your repo to use LF line endings for all files, or just the golden
+// files, by adding the following line to your .gitattributes file:
+//
+// * text=auto eol=lf
 var NormalizeCRLFToLF = os.Getenv("GOTESTTOOLS_GOLDEN_NormalizeCRLFToLF") != "false"
 
 // FlagUpdate returns true when the -update flag has been set.
 func FlagUpdate() bool {
-	return source.Update
+	return source.IsUpdate()
 }
 
 // Open opens the file in ./testdata
@@ -178,7 +186,7 @@
 }
 
 func update(filename string, actual []byte) error {
-	if !source.Update {
+	if !source.IsUpdate() {
 		return nil
 	}
 	if dir := filepath.Dir(Path(filename)); dir != "." {
diff --git a/internal/assert/result.go b/internal/assert/result.go
index 3603206..bb8741e 100644
--- a/internal/assert/result.go
+++ b/internal/assert/result.go
@@ -26,7 +26,7 @@
 		return true
 	}
 
-	if source.Update {
+	if source.IsUpdate() {
 		if updater, ok := result.(updateExpected); ok {
 			const stackIndex = 3 // Assert/Check, assert, RunComparison
 			err := updater.UpdatedExpected(stackIndex)
diff --git a/internal/source/update.go b/internal/source/update.go
index f2006aa..5591bff 100644
--- a/internal/source/update.go
+++ b/internal/source/update.go
@@ -14,12 +14,32 @@
 	"strings"
 )
 
-// Update is set by the -update flag. It indicates the user running the tests
-// would like to update any golden values.
+// IsUpdate is returns true if the -update flag is set. It indicates the user
+// running the tests would like to update any golden values.
+func IsUpdate() bool {
+	if Update {
+		return true
+	}
+	return flag.Lookup("update").Value.(flag.Getter).Get().(bool)
+}
+
+// Update is a shim for testing, and for compatibility with the old -update-golden
+// flag.
 var Update bool
 
 func init() {
-	flag.BoolVar(&Update, "update", false, "update golden values")
+	if f := flag.Lookup("update"); f != nil {
+		getter, ok := f.Value.(flag.Getter)
+		msg := "some other package defined an incompatible -update flag, expected a flag.Bool"
+		if !ok {
+			panic(msg)
+		}
+		if _, ok := getter.Get().(bool); !ok {
+			panic(msg)
+		}
+		return
+	}
+	flag.Bool("update", false, "update golden values")
 }
 
 // ErrNotFound indicates that UpdateExpectedValue failed to find the