aboutsummaryrefslogtreecommitdiff
path: root/actions/config.go
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2022-04-08 23:16:59 -0700
committerEric Biggers <ebiggers@google.com>2022-04-08 23:38:01 -0700
commitca7a84b8aea203025acbda193f78ea98946236b5 (patch)
tree2b9e781db960662c570b5b35f840369130fc87a7 /actions/config.go
parenta224e769a478cc446c05dbfd5eb7e32d31933172 (diff)
Switch to google.golang.org/protobuf/proto
github.com/golang/protobuf/proto has been deprecated in favor of google.golang.org/protobuf/proto, so migrate to the non-deprecated one.
Diffstat (limited to 'actions/config.go')
-rw-r--r--actions/config.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/actions/config.go b/actions/config.go
index a8eb029..03d6b04 100644
--- a/actions/config.go
+++ b/actions/config.go
@@ -29,6 +29,7 @@ import (
"time"
"golang.org/x/sys/unix"
+ "google.golang.org/protobuf/proto"
"github.com/google/fscrypt/crypto"
"github.com/google/fscrypt/filesystem"
@@ -210,7 +211,7 @@ func getHashingCosts(target time.Duration) (*metadata.HashingCosts, error) {
memoryKiBLimit := memoryBytesLimit() / 1024
for {
// Store a copy of the previous costs
- costsPrev := *costs
+ costsPrev := proto.Clone(costs).(*metadata.HashingCosts)
tPrev := t
// Double the memory up to the max, then double the time.
@@ -223,7 +224,7 @@ func getHashingCosts(target time.Duration) (*metadata.HashingCosts, error) {
// If our hashing failed, return the last good set of costs.
if t, err = timeHashingCosts(costs); err != nil {
log.Printf("Hashing with costs={%v} failed: %v\n", costs, err)
- return &costsPrev, nil
+ return costsPrev, nil
}
log.Printf("Costs={%v}\t-> %v\n", costs, t)