Replace sklog.FmtErrorf with skerr.Fmt

Kevin has been using skerr exclusively for the last couple months and
he seems to be a big fan. FmtErrorf doesn't really belong in the sklog
package, and is almost identical to skerr.Fmt.

This change was created by IntelliJ refactoring tools.

Change-Id: I4fb77304cbb6b5f4044a55d5d70adc64aced9ad1
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/250319
Auto-Submit: Ben Wagner aka dogben <benjaminwagner@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Ben Wagner aka dogben <benjaminwagner@google.com>
diff --git a/ct/go/master_scripts/capture_skps_on_workers/main.go b/ct/go/master_scripts/capture_skps_on_workers/main.go
index 42fa6a3..5ea6d73 100644
--- a/ct/go/master_scripts/capture_skps_on_workers/main.go
+++ b/ct/go/master_scripts/capture_skps_on_workers/main.go
@@ -16,6 +16,7 @@
 
 	"go.skia.org/infra/ct/go/master_scripts/master_common"
 	"go.skia.org/infra/ct/go/util"
+	"go.skia.org/infra/go/skerr"
 	"go.skia.org/infra/go/sklog"
 	skutil "go.skia.org/infra/go/util"
 )
@@ -84,10 +85,10 @@
 		chromiumHash := tokens[0]
 		telemetryHash, err := util.TriggerIsolateTelemetrySwarmingTask(ctx, "isolate_telemetry", *runID, chromiumHash, "", *targetPlatform, []string{}, 1*time.Hour, 1*time.Hour, *master_common.Local)
 		if err != nil {
-			return sklog.FmtErrorf("Error encountered when swarming isolate telemetry task: %s", err)
+			return skerr.Fmt("Error encountered when swarming isolate telemetry task: %s", err)
 		}
 		if telemetryHash == "" {
-			return sklog.FmtErrorf("Found empty telemetry hash!")
+			return skerr.Fmt("Found empty telemetry hash!")
 		}
 		isolateDeps = append(isolateDeps, telemetryHash)
 		return nil
diff --git a/ct/go/master_scripts/run_chromium_analysis_on_workers/main.go b/ct/go/master_scripts/run_chromium_analysis_on_workers/main.go
index 670c509..bc6d268 100644
--- a/ct/go/master_scripts/run_chromium_analysis_on_workers/main.go
+++ b/ct/go/master_scripts/run_chromium_analysis_on_workers/main.go
@@ -19,6 +19,7 @@
 	"go.skia.org/infra/ct/go/util"
 	"go.skia.org/infra/go/auth"
 	"go.skia.org/infra/go/gitauth"
+	"go.skia.org/infra/go/skerr"
 	"go.skia.org/infra/go/sklog"
 	skutil "go.skia.org/infra/go/util"
 )
@@ -124,10 +125,10 @@
 	group.Go("build chromium", func() error {
 		chromiumBuilds, err := util.TriggerBuildRepoSwarmingTask(ctx, "build_chromium", *runID, "chromium", *targetPlatform, "", []string{*chromiumHash}, []string{filepath.Join(remoteOutputDir, chromiumPatchName), filepath.Join(remoteOutputDir, skiaPatchName), filepath.Join(remoteOutputDir, v8PatchName)}, []string{}, true /*singleBuild*/, *master_common.Local, 3*time.Hour, 1*time.Hour)
 		if err != nil {
-			return sklog.FmtErrorf("Error encountered when swarming build repo task: %s", err)
+			return skerr.Fmt("Error encountered when swarming build repo task: %s", err)
 		}
 		if len(chromiumBuilds) != 1 {
-			return sklog.FmtErrorf("Expected 1 build but instead got %d: %v", len(chromiumBuilds), chromiumBuilds)
+			return skerr.Fmt("Expected 1 build but instead got %d: %v", len(chromiumBuilds), chromiumBuilds)
 		}
 		chromiumBuild = chromiumBuilds[0]
 		return nil
@@ -139,10 +140,10 @@
 		telemetryIsolatePatches := []string{filepath.Join(remoteOutputDir, chromiumPatchName), filepath.Join(remoteOutputDir, catapultPatchName), filepath.Join(remoteOutputDir, v8PatchName)}
 		telemetryHash, err := util.TriggerIsolateTelemetrySwarmingTask(ctx, "isolate_telemetry", *runID, *chromiumHash, "", *targetPlatform, telemetryIsolatePatches, 1*time.Hour, 1*time.Hour, *master_common.Local)
 		if err != nil {
-			return sklog.FmtErrorf("Error encountered when swarming isolate telemetry task: %s", err)
+			return skerr.Fmt("Error encountered when swarming isolate telemetry task: %s", err)
 		}
 		if telemetryHash == "" {
-			return sklog.FmtErrorf("Found empty telemetry hash!")
+			return skerr.Fmt("Found empty telemetry hash!")
 		}
 		isolateDeps = append(isolateDeps, telemetryHash)
 		return nil
diff --git a/ct/go/master_scripts/run_chromium_perf_on_workers/main.go b/ct/go/master_scripts/run_chromium_perf_on_workers/main.go
index 450cd2f..17957f5 100644
--- a/ct/go/master_scripts/run_chromium_perf_on_workers/main.go
+++ b/ct/go/master_scripts/run_chromium_perf_on_workers/main.go
@@ -19,6 +19,7 @@
 	"go.skia.org/infra/ct/go/util"
 	"go.skia.org/infra/go/auth"
 	"go.skia.org/infra/go/gitauth"
+	"go.skia.org/infra/go/skerr"
 	"go.skia.org/infra/go/sklog"
 	skutil "go.skia.org/infra/go/util"
 )
@@ -159,10 +160,10 @@
 				ctx, "build_chromium", *runID, "chromium", *targetPlatform, "", []string{*chromiumHash}, remotePatches, []string{},
 				true, *master_common.Local, 3*time.Hour, 1*time.Hour)
 			if err != nil {
-				return sklog.FmtErrorf("Error encountered when swarming build repo task: %s", err)
+				return skerr.Fmt("Error encountered when swarming build repo task: %s", err)
 			}
 			if len(chromiumBuilds) != 1 {
-				return sklog.FmtErrorf("Expected 1 build but instead got %d: %v.", len(chromiumBuilds), chromiumBuilds)
+				return skerr.Fmt("Expected 1 build but instead got %d: %v.", len(chromiumBuilds), chromiumBuilds)
 			}
 			chromiumBuildNoPatch = chromiumBuilds[0]
 			chromiumBuildWithPatch = chromiumBuilds[0]
@@ -173,10 +174,10 @@
 				ctx, "build_chromium", *runID, "chromium", *targetPlatform, "", []string{*chromiumHash}, remotePatches, []string{},
 				false, *master_common.Local, 3*time.Hour, 1*time.Hour)
 			if err != nil {
-				return sklog.FmtErrorf("Error encountered when swarming build repo task: %s", err)
+				return skerr.Fmt("Error encountered when swarming build repo task: %s", err)
 			}
 			if len(chromiumBuilds) != 2 {
-				return sklog.FmtErrorf("Expected 2 builds but instead got %d: %v.", len(chromiumBuilds), chromiumBuilds)
+				return skerr.Fmt("Expected 2 builds but instead got %d: %v.", len(chromiumBuilds), chromiumBuilds)
 			}
 			chromiumBuildNoPatch = chromiumBuilds[0]
 			chromiumBuildWithPatch = chromiumBuilds[1]
diff --git a/ct/go/util/ct_perf.go b/ct/go/util/ct_perf.go
index 24138d4..fe444ff 100644
--- a/ct/go/util/ct_perf.go
+++ b/ct/go/util/ct_perf.go
@@ -18,6 +18,7 @@
 
 	"go.skia.org/infra/go/exec"
 	"go.skia.org/infra/go/git"
+	"go.skia.org/infra/go/skerr"
 	"go.skia.org/infra/go/sklog"
 	"go.skia.org/infra/go/util"
 	"go.skia.org/infra/perf/go/ingestcommon"
@@ -89,39 +90,39 @@
 	// Step 1: Add a commit to CT Perf's synthetic repo in CT_PERF_REPO
 	tmpDir, err := ioutil.TempDir(workdir, uniqueID)
 	if err != nil {
-		return sklog.FmtErrorf("Could not create tmpDir in %s: %s", workdir, err)
+		return skerr.Fmt("Could not create tmpDir in %s: %s", workdir, err)
 	}
 	checkout, err := git.NewCheckout(ctx, CT_PERF_REPO, tmpDir)
 	if err != nil {
-		return sklog.FmtErrorf("Could not create %s checkout in %s: %s", CT_PERF_REPO, tmpDir, err)
+		return skerr.Fmt("Could not create %s checkout in %s: %s", CT_PERF_REPO, tmpDir, err)
 	}
 	hash, err := commitToSyntheticRepo(ctx, groupName, uniqueID, checkout)
 	if err != nil {
-		return sklog.FmtErrorf("Could not commit to %s: %s", CT_PERF_REPO, err)
+		return skerr.Fmt("Could not commit to %s: %s", CT_PERF_REPO, err)
 	}
 
 	// Step 2: Constructs a results struct in the format of https://github.com/google/skia-buildbot/blob/master/perf/FORMAT.md
 	//         Ensure that the results file has as key the runID, groupName and the git hash.
 	ctPerfData, err := convertCSVToBenchData(hash, groupName, runID, pathToCSVResults)
 	if err != nil {
-		return sklog.FmtErrorf("Could not convert CSV from %s to BenchData: %s", pathToCSVResults, err)
+		return skerr.Fmt("Could not convert CSV from %s to BenchData: %s", pathToCSVResults, err)
 	}
 
 	// Step 3: Create JSON file from the ctPerfData struct.
 	perfJson, err := json.MarshalIndent(ctPerfData, "", "  ")
 	if err != nil {
-		return sklog.FmtErrorf("Could not convert %v to JSON: %s", ctPerfData, err)
+		return skerr.Fmt("Could not convert %v to JSON: %s", ctPerfData, err)
 	}
 	jsonFile := path.Join(workdir, fmt.Sprintf("%s.json", uniqueID))
 	if err := ioutil.WriteFile(jsonFile, perfJson, 0644); err != nil {
-		return sklog.FmtErrorf("Could not write to %s: %s", jsonFile, err)
+		return skerr.Fmt("Could not write to %s: %s", jsonFile, err)
 	}
 
 	// Step 4: Upload the results file to Google storage bucket CT_PERF_BUCKET for ingestion by ct-perf.skia.org.
 	//         It is stored in location of this format: gs://<bucket>/<one or more dir names>/YYYY/MM/DD/HH/<zero or more dir names><some unique name>.json
 	gsDir := path.Join("ingest", time.Now().UTC().Format("2006/01/02/15/"))
 	if err := gs.UploadFileToBucket(filepath.Base(jsonFile), workdir, gsDir, CT_PERF_BUCKET); err != nil {
-		return sklog.FmtErrorf("Could not upload %s to gs://%s/%s: %s", jsonFile, CT_PERF_BUCKET, gsDir, err)
+		return skerr.Fmt("Could not upload %s to gs://%s/%s: %s", jsonFile, CT_PERF_BUCKET, gsDir, err)
 	}
 	sklog.Infof("Successfully uploaded to gs://%s/%s/%s", CT_PERF_BUCKET, gsDir, filepath.Base(jsonFile))
 
@@ -133,10 +134,10 @@
 func commitToSyntheticRepo(ctx context.Context, groupName, uniqueID string, checkout *git.Checkout) (string, error) {
 	// Create a new file using the uniqueID and commit it to the synthetic repo.
 	if err := ioutil.WriteFile(filepath.Join(checkout.Dir(), uniqueID), []byte(uniqueID), 0644); err != nil {
-		return "", sklog.FmtErrorf("Failed to write %s: %s", uniqueID, err)
+		return "", skerr.Fmt("Failed to write %s: %s", uniqueID, err)
 	}
 	if msg, err := checkout.Git(ctx, "add", uniqueID); err != nil {
-		return "", sklog.FmtErrorf("Failed to add file %q: %s", msg, err)
+		return "", skerr.Fmt("Failed to add file %q: %s", msg, err)
 	}
 	output := bytes.Buffer{}
 	cmd := exec.Command{
@@ -147,16 +148,16 @@
 		CombinedOutput: &output,
 	}
 	if err := exec.Run(ctx, &cmd); err != nil {
-		return "", sklog.FmtErrorf("Failed to commit updated file %q: %s", output.String(), err)
+		return "", skerr.Fmt("Failed to commit updated file %q: %s", output.String(), err)
 	}
 	// Record the full hash to use as key in the results file.
 	hashes, err := checkout.RevList(ctx, "HEAD", "-n1")
 	if err != nil {
-		return "", sklog.FmtErrorf("Could not have full hash of %s: %s", checkout.Dir(), err)
+		return "", skerr.Fmt("Could not have full hash of %s: %s", checkout.Dir(), err)
 	}
 	hash := hashes[0]
 	if msg, err := checkout.Git(ctx, "push", "origin", "master"); err != nil {
-		return "", sklog.FmtErrorf("Failed to push updated checkout %q: %s", msg, err)
+		return "", skerr.Fmt("Failed to push updated checkout %q: %s", msg, err)
 	}
 	return hash, nil
 }
@@ -188,7 +189,7 @@
 	// Read and store the first line of headers.
 	headers, err := reader.Read()
 	if err != nil {
-		return nil, sklog.FmtErrorf("Could not read first line of %s: %s", pathToCSVResults, err)
+		return nil, skerr.Fmt("Could not read first line of %s: %s", pathToCSVResults, err)
 	}
 	// Below regex will be used to extract page name (without rank) and rank.
 	rePageNameWithRank := regexp.MustCompile(`(.*) \(#([0-9]+)\)`)
@@ -198,7 +199,7 @@
 		if err == io.EOF {
 			break
 		} else if err != nil {
-			return nil, sklog.FmtErrorf("Error when reading CSV from %s: %s", pathToCSVResults, err)
+			return nil, skerr.Fmt("Error when reading CSV from %s: %s", pathToCSVResults, err)
 		}
 
 		pageNameNoRank := ""
diff --git a/datahopper/go/datahopper/jobs.go b/datahopper/go/datahopper/jobs.go
index f847422..f3b1d1f 100644
--- a/datahopper/go/datahopper/jobs.go
+++ b/datahopper/go/datahopper/jobs.go
@@ -467,7 +467,7 @@
 func getMostRecentCachedRev(ctx context.Context, tcc *task_cfg_cache.TaskCfgCache, repoUrl string, repo *repograph.Graph) (*repograph.Commit, *specs.TasksCfg, error) {
 	head := repo.Get("master")
 	if head == nil {
-		return nil, nil, sklog.FmtErrorf("Can't resolve %q in %q.", "master", repoUrl)
+		return nil, nil, skerr.Fmt("Can't resolve %q in %q.", "master", repoUrl)
 	}
 	var commit *repograph.Commit
 	var cfg *specs.TasksCfg
@@ -527,7 +527,7 @@
 		if err := head.Recurse(func(c *repograph.Commit) error {
 			// Stop if this commit is outside the scheduling window.
 			if in, err := m.window.TestCommitHash(repoUrl, c.Hash); err != nil {
-				return sklog.FmtErrorf("TestCommitHash: %s", err)
+				return skerr.Fmt("TestCommitHash: %s", err)
 			} else if !in {
 				return repograph.ErrStopRecursing
 			}
@@ -539,7 +539,7 @@
 			for name := range todo {
 				jobs, err := m.jCache.GetJobsByRepoState(name, rs)
 				if err != nil {
-					return sklog.FmtErrorf("GetJobsByRepoState: %s", err)
+					return skerr.Fmt("GetJobsByRepoState: %s", err)
 				}
 				for _, j := range jobs {
 					if j.Done() {
@@ -554,7 +554,7 @@
 			// Check that the remaining JobSpecs are still valid at this commit.
 			taskCfg, err := m.taskCfgCache.Get(ctx, rs)
 			if err != nil {
-				return sklog.FmtErrorf("Error reading TaskCfg for %q at %q: %s", repoUrl, c.Hash, err)
+				return skerr.Fmt("Error reading TaskCfg for %q at %q: %s", repoUrl, c.Hash, err)
 			}
 			for name := range todo {
 				if _, ok := taskCfg.Jobs[name]; !ok {
diff --git a/docserverk/go/ssi/ssi.go b/docserverk/go/ssi/ssi.go
index cef9985..028668d 100644
--- a/docserverk/go/ssi/ssi.go
+++ b/docserverk/go/ssi/ssi.go
@@ -37,7 +37,7 @@
 
 	"cloud.google.com/go/storage"
 	"go.skia.org/infra/go/gcs"
-	"go.skia.org/infra/go/sklog"
+	"go.skia.org/infra/go/skerr"
 	"go.skia.org/infra/go/util"
 	"google.golang.org/api/iterator"
 )
@@ -88,19 +88,19 @@
 			// Parse the tag parameters, which are simply space separated 'key=value' pairs.
 			params, err := parseParams(paramStr)
 			if err != nil {
-				return nil, sklog.FmtErrorf("Error parsing params in tag '%s': %s", string(body[tagStart:tagEnd]), err)
+				return nil, skerr.Fmt("Error parsing params in tag '%s': %s", string(body[tagStart:tagEnd]), err)
 			}
 
 			// Find the function registered for the given tag.
 			fn, ok := processFNs[id]
 			if !ok {
-				return nil, sklog.FmtErrorf("Unable to find function for tag '%s'", string(body[tagStart:tagEnd]))
+				return nil, skerr.Fmt("Unable to find function for tag '%s'", string(body[tagStart:tagEnd]))
 			}
 
 			// Run the function and insert the returned byte slice instead of the tag.
 			fill, err := fn(params)
 			if err != nil {
-				return nil, sklog.FmtErrorf("Error processing tag '%s': %s", string(body[tagStart:tagEnd]), err)
+				return nil, skerr.Fmt("Error processing tag '%s': %s", string(body[tagStart:tagEnd]), err)
 			}
 			prefix := body[currStart:tagStart]
 			parts = append(parts, prefix, fill)
@@ -134,7 +134,7 @@
 		k := strings.TrimSpace(kv[0])
 		v := ""
 		if k == "" {
-			return nil, sklog.FmtErrorf("Missing key in parameters '%s'", paramsStr)
+			return nil, skerr.Fmt("Missing key in parameters '%s'", paramsStr)
 		}
 		if len(kv) == 2 {
 			v = strings.TrimSpace(kv[1])
@@ -202,7 +202,7 @@
 func (g *gceFolderListing) generateFolderListing(params map[string]string) ([]byte, error) {
 	gcsPath, ok := params["path"]
 	if !ok {
-		return nil, sklog.FmtErrorf("No 'path' parameter provided in tag.")
+		return nil, skerr.Fmt("No 'path' parameter provided in tag.")
 	}
 
 	bucket, path := gcs.SplitGSPath(gcsPath)
@@ -217,7 +217,7 @@
 			break
 		}
 		if err != nil {
-			return nil, sklog.FmtErrorf("Error retrieving object attributes: %s", err)
+			return nil, skerr.Fmt("Error retrieving object attributes: %s", err)
 		}
 
 		// Add entry if it's not a folder, if we have meta data and if the item is public.
@@ -247,7 +247,7 @@
 	for _, attrs := range items {
 		fmt.Println(attrs["created"])
 		if err := gceListingRowTmpl.Execute(&buf, attrs); err != nil {
-			return nil, sklog.FmtErrorf("Unable to execute template: %s", err)
+			return nil, skerr.Fmt("Unable to execute template: %s", err)
 		}
 	}
 	return []byte(fmt.Sprintf(listGCSTagSnippet, buf.String())), nil
diff --git a/go/bt/bt.go b/go/bt/bt.go
index 7b20ded..cb4f761 100644
--- a/go/bt/bt.go
+++ b/go/bt/bt.go
@@ -5,6 +5,7 @@
 	"os"
 
 	"cloud.google.com/go/bigtable"
+	"go.skia.org/infra/go/skerr"
 	"go.skia.org/infra/go/sklog"
 	"go.skia.org/infra/go/util"
 	"google.golang.org/grpc/codes"
@@ -25,13 +26,13 @@
 	// Set up admin client, tables, and column families.
 	adminClient, err := bigtable.NewAdminClient(ctx, projectID, instanceID)
 	if err != nil {
-		return sklog.FmtErrorf("Unable to create admin client: %s", err)
+		return skerr.Fmt("Unable to create admin client: %s", err)
 	}
 
 	// Create the table. Ignore error if it already existed.
 	err, code := ErrToCode(adminClient.CreateTable(ctx, tableID))
 	if err != nil && code != codes.AlreadyExists {
-		return sklog.FmtErrorf("Error creating table %s: %s", tableID, err)
+		return skerr.Fmt("Error creating table %s: %s", tableID, err)
 	} else {
 		sklog.Infof("Created table: %s", tableID)
 	}
@@ -40,7 +41,7 @@
 	for _, colFamName := range colFamilies {
 		err, code = ErrToCode(adminClient.CreateColumnFamily(ctx, tableID, colFamName))
 		if err != nil && code != codes.AlreadyExists {
-			return sklog.FmtErrorf("Error creating column family %s in table %s: %s", colFamName, tableID, err)
+			return skerr.Fmt("Error creating column family %s in table %s: %s", colFamName, tableID, err)
 		}
 	}
 
@@ -54,7 +55,7 @@
 	// Set up admin client, tables, and column families.
 	adminClient, err := bigtable.NewAdminClient(ctx, projectID, instanceID)
 	if err != nil {
-		return sklog.FmtErrorf("Unable to create admin client: %s", err)
+		return skerr.Fmt("Unable to create admin client: %s", err)
 	}
 	defer func() {
 		if err != nil {
diff --git a/go/ds/ds.go b/go/ds/ds.go
index cfd2f72..46f258f 100644
--- a/go/ds/ds.go
+++ b/go/ds/ds.go
@@ -250,7 +250,7 @@
 		}(slice)
 	}
 	if err := egroup.Wait(); err != nil {
-		return 0, sklog.FmtErrorf("Error deleting entities: %s", err)
+		return 0, skerr.Fmt("Error deleting entities: %s", err)
 	}
 
 	// If we need to wait loop until the entity count goes to zero.
@@ -385,7 +385,7 @@
 	if k.cursorStr != "" {
 		cursor, err := datastore.DecodeCursor(k.cursorStr)
 		if err != nil {
-			return nil, false, sklog.FmtErrorf("Bad cursor %s: %s", k.cursorStr, err)
+			return nil, false, skerr.Fmt("Bad cursor %s: %s", k.cursorStr, err)
 		}
 		query = query.Start(cursor)
 	}
@@ -403,13 +403,13 @@
 	}
 
 	if err != iterator.Done {
-		return nil, false, sklog.FmtErrorf("Error retrieving keys: %s", err)
+		return nil, false, skerr.Fmt("Error retrieving keys: %s", err)
 	}
 
 	// Get the string for the next page.
 	cursor, err := it.Cursor()
 	if err != nil {
-		return nil, false, sklog.FmtErrorf("Error retrieving next cursor: %s", err)
+		return nil, false, skerr.Fmt("Error retrieving next cursor: %s", err)
 	}
 
 	// Check if the string representation of the cursor has changed.
diff --git a/go/gerrit/gerrit.go b/go/gerrit/gerrit.go
index 4c7825b..04ec3fa 100644
--- a/go/gerrit/gerrit.go
+++ b/go/gerrit/gerrit.go
@@ -249,13 +249,13 @@
 func NewGerrit(gerritUrl, gitCookiesPath string, client *http.Client) (*Gerrit, error) {
 	parsedUrl, err := url.Parse(gerritUrl)
 	if err != nil {
-		return nil, sklog.FmtErrorf("Unable to parse gerrit URL: %s", err)
+		return nil, skerr.Fmt("Unable to parse gerrit URL: %s", err)
 	}
 
 	regExStr := fmt.Sprintf(extractRegTmpl, parsedUrl.Host)
 	extractRegEx, err := regexp.Compile(regExStr)
 	if err != nil {
-		return nil, sklog.FmtErrorf("Unable to compile regular expression '%s'. Error: %s", regExStr, err)
+		return nil, skerr.Fmt("Unable to compile regular expression '%s'. Error: %s", regExStr, err)
 	}
 
 	if client == nil {
@@ -287,7 +287,7 @@
 func GitCookieAuthDaemonPath() (string, error) {
 	usr, err := user.Current()
 	if err != nil {
-		return "", sklog.FmtErrorf("Unable to retrieve user for git_auth_deamon default cookie path.")
+		return "", skerr.Fmt("Unable to retrieve user for git_auth_deamon default cookie path.")
 	}
 	return filepath.Join(usr.HomeDir, ".git-credential-cache", "cookie"), nil
 }
@@ -399,7 +399,7 @@
 		if err == ErrNotFound {
 			return nil, err
 		}
-		return nil, sklog.FmtErrorf("Failed to load details for issue %d: %v", issue, err)
+		return nil, skerr.Fmt("Failed to load details for issue %d: %v", issue, err)
 	}
 	return fixupChangeInfo(fullIssue), nil
 }
diff --git a/go/gevent/gevent.go b/go/gevent/gevent.go
index 6ececea..9be42c9 100644
--- a/go/gevent/gevent.go
+++ b/go/gevent/gevent.go
@@ -187,7 +187,7 @@
 				},
 			})
 			if err != nil {
-				return "", sklog.FmtErrorf("Error registering event: %s", err)
+				return "", skerr.Fmt("Error registering event: %s", err)
 			}
 			sklog.Infof("Created storage notification: %s", spew.Sdump(notificationInfo))
 		} else {
@@ -214,10 +214,10 @@
 	// Create the topic if it doesn't exist yet.
 	d.topic = d.client.Topic(topicName)
 	if exists, err := d.topic.Exists(ctx); err != nil {
-		return sklog.FmtErrorf("Error checking whether topic exits: %s", err)
+		return skerr.Fmt("Error checking whether topic exits: %s", err)
 	} else if !exists {
 		if d.topic, err = d.client.CreateTopic(ctx, topicName); err != nil {
-			return sklog.FmtErrorf("Error creating pubsub topic '%s': %s", topicName, err)
+			return skerr.Fmt("Error creating pubsub topic '%s': %s", topicName, err)
 		}
 	}
 
@@ -225,13 +225,13 @@
 	subName := fmt.Sprintf("%s+%s", subscriberName, topicName)
 	d.sub = d.client.Subscription(subName)
 	if exists, err := d.sub.Exists(ctx); err != nil {
-		return sklog.FmtErrorf("Error checking existence of pubsub subscription '%s': %s", subName, err)
+		return skerr.Fmt("Error checking existence of pubsub subscription '%s': %s", subName, err)
 	} else if !exists {
 		d.sub, err = d.client.CreateSubscription(ctx, subName, pubsub.SubscriptionConfig{
 			Topic: d.topic,
 		})
 		if err != nil {
-			return sklog.FmtErrorf("Error creating pubsub subscription '%s': %s", subName, err)
+			return skerr.Fmt("Error creating pubsub subscription '%s': %s", subName, err)
 		}
 	}
 	d.sub.ReceiveSettings.MaxOutstandingMessages = MaximumConcurrentPublishesPerTopic
@@ -373,13 +373,13 @@
 	// Extract the object attributes.
 	attrs := &objectAttrs{}
 	if err := json.Unmarshal(msg.Data, attrs); err != nil {
-		return nil, nil, false, sklog.FmtErrorf("Unable to decode object attributes: %s", err)
+		return nil, nil, false, skerr.Fmt("Unable to decode object attributes: %s", err)
 	}
 
 	// decode the MD5 hash: base64 -> bytes -> hex-encoded-string
 	md5Bytes, err := base64.StdEncoding.DecodeString(attrs.Base64EncodedMD5Hash)
 	if err != nil {
-		return nil, nil, false, sklog.FmtErrorf("Unable to decode base64 encoded MD5 hash (%s): %s", attrs.Base64EncodedMD5Hash, err)
+		return nil, nil, false, skerr.Fmt("Unable to decode base64 encoded MD5 hash (%s): %s", attrs.Base64EncodedMD5Hash, err)
 	}
 	md5HashStr := hex.EncodeToString(md5Bytes)
 
diff --git a/go/ingestion/helpers.go b/go/ingestion/helpers.go
index 879b61a..815c009 100644
--- a/go/ingestion/helpers.go
+++ b/go/ingestion/helpers.go
@@ -159,7 +159,7 @@
 		return NewGoogleStorageSource(id, dataSource.Bucket, dataSource.Dir, client, eventBus)
 	}
 
-	return nil, sklog.FmtErrorf("Unable to create source. At least a bucket and directory must be supplied")
+	return nil, skerr.Fmt("Unable to create source. At least a bucket and directory must be supplied")
 }
 
 // validIngestionFile returns true if the given file name matches basic rules.
diff --git a/go/login/login.go b/go/login/login.go
index 76998b2..7ae475c 100644
--- a/go/login/login.go
+++ b/go/login/login.go
@@ -43,6 +43,7 @@
 	"go.skia.org/infra/go/allowed"
 	"go.skia.org/infra/go/httputils"
 	"go.skia.org/infra/go/metadata"
+	"go.skia.org/infra/go/skerr"
 	"go.skia.org/infra/go/sklog"
 	"go.skia.org/infra/go/util"
 	"golang.org/x/oauth2"
@@ -189,11 +190,11 @@
 
 		b, err := ioutil.ReadFile(clientSecretFile)
 		if err != nil {
-			return sklog.FmtErrorf("Failed to read from metadata and from %s. Got error: %s", clientSecretFile, err)
+			return skerr.Fmt("Failed to read from metadata and from %s. Got error: %s", clientSecretFile, err)
 		}
 		config, err := google.ConfigFromJSON(b)
 		if err != nil {
-			return sklog.FmtErrorf("Failed to read from metadata and decode %s. Got error: %s", clientSecretFile, err)
+			return skerr.Fmt("Failed to read from metadata and decode %s. Got error: %s", clientSecretFile, err)
 		}
 		sklog.Infof("Successfully read client secret from %s", clientSecretFile)
 		clientID = config.ClientID
diff --git a/go/sklog/sklog.go b/go/sklog/sklog.go
index 71213e9..71ecbfe 100644
--- a/go/sklog/sklog.go
+++ b/go/sklog/sklog.go
@@ -295,11 +295,3 @@
 		glog.ErrorDepth(depth, msg)
 	}
 }
-
-// FmtError is a wrapper around fmt.Errorf that prepends the source location
-// (filename and line number) of the caller.
-func FmtErrorf(fmtStr string, args ...interface{}) error {
-	stackEntry := skerr.CallStack(1, 2)[0]
-	codeRef := fmt.Sprintf("%s:%d:", stackEntry.File, stackEntry.Line)
-	return fmt.Errorf(codeRef+fmtStr, args...)
-}
diff --git a/go/sktrace/sktrace.go b/go/sktrace/sktrace.go
index bef30a7..3dd0c65 100644
--- a/go/sktrace/sktrace.go
+++ b/go/sktrace/sktrace.go
@@ -7,6 +7,7 @@
 
 	"contrib.go.opencensus.io/exporter/stackdriver"
 	"go.opencensus.io/trace"
+	"go.skia.org/infra/go/skerr"
 	"go.skia.org/infra/go/sklog"
 	"golang.org/x/oauth2"
 )
@@ -30,7 +31,7 @@
 		ProjectID: projectID,
 	}
 	if exporter, err = stackdriver.NewExporter(sdOptions); err != nil {
-		return nil, sklog.FmtErrorf("Error creating stackdriver exporter: %s", err)
+		return nil, skerr.Fmt("Error creating stackdriver exporter: %s", err)
 	}
 	sklog.Infof("StackDriver trace exporter created.")
 
diff --git a/go/util/concurrency_test.go b/go/util/concurrency_test.go
index f3cff56..0f8687d 100644
--- a/go/util/concurrency_test.go
+++ b/go/util/concurrency_test.go
@@ -7,7 +7,7 @@
 	"time"
 
 	"github.com/stretchr/testify/require"
-	"go.skia.org/infra/go/sklog"
+	"go.skia.org/infra/go/skerr"
 	"go.skia.org/infra/go/testutils/unittest"
 )
 
@@ -29,7 +29,7 @@
 		mutex.Lock()
 		concurMap[id]++
 		if concurMap[id] > 1 {
-			errCh <- sklog.FmtErrorf("More than one thread with the same ID entered the critical section")
+			errCh <- skerr.Fmt("More than one thread with the same ID entered the critical section")
 		}
 		mutex.Unlock()
 
diff --git a/golden/go/dsutil/dsutil.go b/golden/go/dsutil/dsutil.go
index 638239e..343cd53 100644
--- a/golden/go/dsutil/dsutil.go
+++ b/golden/go/dsutil/dsutil.go
@@ -8,7 +8,7 @@
 
 	"cloud.google.com/go/datastore"
 	"go.skia.org/infra/go/ds"
-	"go.skia.org/infra/go/sklog"
+	"go.skia.org/infra/go/skerr"
 	"go.skia.org/infra/go/util"
 )
 
@@ -56,7 +56,7 @@
 // that are no longer within the defined time delta.
 func (l *RecentKeysList) Add(tx *datastore.Transaction, newKey *datastore.Key) error {
 	if newKey.ID <= 0 {
-		return sklog.FmtErrorf("Key contains invalid numeric ID. It must be generated by calling TimeSortableKey")
+		return skerr.Fmt("Key contains invalid numeric ID. It must be generated by calling TimeSortableKey")
 	}
 	return l.updateRecentKeys(tx, newKey, false)
 }
diff --git a/proberk/go/proberk/main.go b/proberk/go/proberk/main.go
index f336b02..7092d90 100644
--- a/proberk/go/proberk/main.go
+++ b/proberk/go/proberk/main.go
@@ -21,6 +21,7 @@
 	"go.skia.org/infra/go/httputils"
 	"go.skia.org/infra/go/human"
 	"go.skia.org/infra/go/metrics2"
+	"go.skia.org/infra/go/skerr"
 	"go.skia.org/infra/go/sklog"
 	"go.skia.org/infra/go/util"
 	"go.skia.org/infra/proberk/go/types"
@@ -266,18 +267,18 @@
 
 	conn, err := tls.Dial("tcp", targetAddr, conf)
 	if err != nil {
-		return sklog.FmtErrorf("Error dialing %s: %s", targetAddr, err)
+		return skerr.Fmt("Error dialing %s: %s", targetAddr, err)
 	}
 	defer util.Close(conn)
 
 	// Establish the connection.
 	if err := conn.Handshake(); err != nil {
-		return sklog.FmtErrorf("Handshake with %s failed: %s", targetAddr, err)
+		return skerr.Fmt("Handshake with %s failed: %s", targetAddr, err)
 	}
 
 	certs := conn.ConnectionState().PeerCertificates
 	if len(certs) == 0 {
-		return sklog.FmtErrorf("Unable to retrieve peer certificates for %s", targetAddr)
+		return skerr.Fmt("Unable to retrieve peer certificates for %s", targetAddr)
 	}
 
 	// Validate the certificate chain
@@ -285,7 +286,7 @@
 	for _, cert := range certs {
 		// Make sure the cert is valid.
 		if now.Before(cert.NotBefore) {
-			return sklog.FmtErrorf("Certificate for %s is not valid yet", targetAddr)
+			return skerr.Fmt("Certificate for %s is not valid yet", targetAddr)
 		}
 
 		// If the 'expected' value of the probe configuration contains a positive
@@ -299,7 +300,7 @@
 		// Make sure the cert is not expired.
 		delta := cert.NotAfter.Sub(now)
 		if delta < minExpirationDelta {
-			return sklog.FmtErrorf("Certificate for %s is expired or will expire in %s.", targetAddr, human.Duration(delta))
+			return skerr.Fmt("Certificate for %s is expired or will expire in %s.", targetAddr, human.Duration(delta))
 		}
 	}
 
diff --git a/skolo/go/metadata_server_k8s/svc_config.go b/skolo/go/metadata_server_k8s/svc_config.go
index ea62960..7e051cb 100644
--- a/skolo/go/metadata_server_k8s/svc_config.go
+++ b/skolo/go/metadata_server_k8s/svc_config.go
@@ -5,7 +5,7 @@
 
 	"go.skia.org/infra/go/config"
 	"go.skia.org/infra/go/fileutil"
-	"go.skia.org/infra/go/sklog"
+	"go.skia.org/infra/go/skerr"
 )
 
 // ServiceAccountConf is one entry in the configuration file that defines multiple service accounts
@@ -19,12 +19,12 @@
 
 func readConfigFile(confFile string) ([]*ServiceAccountConf, error) {
 	if confFile == "" {
-		return nil, sklog.FmtErrorf("Must provide a config file.")
+		return nil, skerr.Fmt("Must provide a config file.")
 	}
 
 	ret := []*ServiceAccountConf{}
 	if err := config.ParseConfigFile(confFile, "", &ret); err != nil {
-		return nil, sklog.FmtErrorf("Error parsing configuration file: %s", err)
+		return nil, skerr.Fmt("Error parsing configuration file: %s", err)
 	}
 
 	// Make sure the entries reference existing files and are consistent.
@@ -35,18 +35,18 @@
 
 		// Make sure there is no empty entry.
 		if c.Project == "" || c.Email == "" || c.KeyFile == "" || len(c.Clients) == 0 {
-			return nil, sklog.FmtErrorf("No entry in config file %s can be empty.", confFile)
+			return nil, skerr.Fmt("No entry in config file %s can be empty.", confFile)
 		}
 		for _, oneClient := range c.Clients {
 			if strings.TrimSpace(oneClient) == "" {
-				return nil, sklog.FmtErrorf("'clients' in file %s cannot contain empty strings", confFile)
+				return nil, skerr.Fmt("'clients' in file %s cannot contain empty strings", confFile)
 			}
 		}
 
 		// Make sure the files exist. If they are internally invalid it will be caught when they are
 		// parsed and used.
 		if !fileutil.FileExists(c.KeyFile) {
-			return nil, sklog.FmtErrorf("File %q referenced in config file %q does not exist", c.KeyFile, confFile)
+			return nil, skerr.Fmt("File %q referenced in config file %q does not exist", c.KeyFile, confFile)
 		}
 	}