aboutsummaryrefslogtreecommitdiff
path: root/cryptfs
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-11-14 17:16:17 +0100
committerJakob Unterwurzacher2015-11-14 17:16:17 +0100
commit61aacb5c1bd3368366484b9e03cf90ccf85f1125 (patch)
treed62d9fed9fb500a6051e2b4919a094fd1556de24 /cryptfs
parentf9c21e91aab4799425b25f5fb876c9d95865d9dc (diff)
Run go fmt and go vet
Diffstat (limited to 'cryptfs')
-rw-r--r--cryptfs/config_file.go16
-rw-r--r--cryptfs/config_test.go6
-rw-r--r--cryptfs/content_test.go2
-rw-r--r--cryptfs/log.go2
4 files changed, 14 insertions, 12 deletions
diff --git a/cryptfs/config_file.go b/cryptfs/config_file.go
index 346bef8..db0abf5 100644
--- a/cryptfs/config_file.go
+++ b/cryptfs/config_file.go
@@ -10,7 +10,7 @@ import "os"
const (
// The dot "." is not used in base64url (RFC4648), hence
// we can never clash with an encrypted file.
- ConfDefaultName = "gocryptfs.conf"
+ ConfDefaultName = "gocryptfs.conf"
FlagPlaintextNames = "PlaintextNames"
)
@@ -79,12 +79,12 @@ func LoadConfFile(filename string, password string) ([]byte, *ConfFile, error) {
}
// Verify that we know all feature flags
- for _, flag := range(cf.FeatureFlags) {
- switch(flag) {
- case FlagPlaintextNames:
- continue
- default:
- return nil, nil, fmt.Errorf("Unsupported feature flag %s\n", flag)
+ for _, flag := range cf.FeatureFlags {
+ switch flag {
+ case FlagPlaintextNames:
+ continue
+ default:
+ return nil, nil, fmt.Errorf("Unsupported feature flag %s\n", flag)
}
}
@@ -151,7 +151,7 @@ func (cf *ConfFile) WriteFile() error {
// isFeatureFlagSet - is the feature flag "flagWant" enabled?
func (cf *ConfFile) isFeatureFlagSet(flagWant string) bool {
- for _, flag := range(cf.FeatureFlags) {
+ for _, flag := range cf.FeatureFlags {
if flag == flagWant {
return true
}
diff --git a/cryptfs/config_test.go b/cryptfs/config_test.go
index 2e46a25..cd8ed2f 100644
--- a/cryptfs/config_test.go
+++ b/cryptfs/config_test.go
@@ -26,13 +26,13 @@ func TestLoadV2(t *testing.T) {
}
elapsed := time.Since(t1)
- if elapsed < 100 *time.Millisecond {
- t.Errorf("scrypt calculation runs too fast: %d ms", elapsed / time.Millisecond)
+ if elapsed < 100*time.Millisecond {
+ t.Errorf("scrypt calculation runs too fast: %d ms", elapsed/time.Millisecond)
}
}
func TestLoadV2PwdError(t *testing.T) {
- if ! testing.Verbose() {
+ if !testing.Verbose() {
Warn.Disable()
}
_, _, err := LoadConfFile("config_test/v2.conf", "wrongpassword")
diff --git a/cryptfs/content_test.go b/cryptfs/content_test.go
index dbedf87..1b269bd 100644
--- a/cryptfs/content_test.go
+++ b/cryptfs/content_test.go
@@ -57,7 +57,7 @@ func TestCiphertextRange(t *testing.T) {
skipBytes := blocks[0].Skip
if alignedLength < r.length {
- t.Errorf("alignedLength=%s is smaller than length=%d", alignedLength, r.length)
+ t.Errorf("alignedLength=%d is smaller than length=%d", alignedLength, r.length)
}
if (alignedOffset-HEADER_LEN)%f.cipherBS != 0 {
t.Errorf("alignedOffset=%d is not aligned", alignedOffset)
diff --git a/cryptfs/log.go b/cryptfs/log.go
index 6173e63..64dc80e 100644
--- a/cryptfs/log.go
+++ b/cryptfs/log.go
@@ -47,7 +47,9 @@ func (l *logChannel) Md5sum(buf []byte) string {
// Debug messages
var Debug = logChannel{false}
+
// Informational message e.g. startup information
var Info = logChannel{true}
+
// A warning, meaning nothing serious by itself but might indicate problems
var Warn = logChannel{true}