Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | cmd/hancock: encode manifest with newlines and tabs | 
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive | 
| Timelines: | family | ancestors | descendants | both | trunk | 
| Files: | files | file ages | folders | 
| SHA3-256: | 
7fa912b1c17f4f87cb2ad589a799dc7c | 
| User & Date: | dnc 2020-03-02 02:03:33 | 
Context
| 
   2020-03-02 
 | ||
| 02:04 | cmd/hancock-sign: changed default key location also documentation tweaks check-in: 6dd83bb80a user: dnc tags: trunk | |
| 02:03 | cmd/hancock: encode manifest with newlines and tabs check-in: 7fa912b1c1 user: dnc tags: trunk | |
| 02:03 | cmd/hancock: adjust verbosity of messages check-in: 776783b92d user: dnc tags: trunk | |
Changes
Changes to cmd/hancock/manifest.go.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
138
139
140
141
142
143
144
145
146
147
148
149
 | 
// hancock manifest /path/to/source/file [...] // // Output is JSON-encoded data about the source file(s), in the format // expected by `hancock-sign`. package main import ( "fmt" "os" "path/filepath" "strings" "time" "github.com/pkg/errors" ................................................................................ } else if err != nil { command.Error(err) // log error, continue loop } } return nil } func mustEncode(v interface{}) string { enc, err := model.EncodeToString(v) command.Check(err) return enc }  | 
>
 
>
<
|
>
>
>
|
 | 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
 | 
// hancock manifest /path/to/source/file [...] // // Output is JSON-encoded data about the source file(s), in the format // expected by `hancock-sign`. package main import ( "encoding/json" "fmt" "os" "path/filepath" "strings" "time" "github.com/pkg/errors" ................................................................................ } else if err != nil { command.Error(err) // log error, continue loop } } return nil } // Manifests are JSON-encodable. Here we encode with human-friendly indent. func mustEncode(v interface{}) string { enc, err := json.MarshalIndent(v, "", "\t") if err != nil { panic(err) } return string(enc) }  | 
Changes to model/manifest.go.
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
...
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
 | 
// Manifest // // A file manifest is a description of a source file, produced by an // authority who signs the manifest to produce testimony. package model import ( "encoding/json" "fmt" "io" "os" "strings" "time" ) ................................................................................ for _, m := range this.Message { if len(m) > messageLength { return fmt.Errorf("message length (%d) exceeds limit (%d)", len(m), messageLength) } } return nil } func mustJSONXXX(v interface{}) string { enc, err := json.MarshalIndent(v, "", "\t") if err != nil { panic(err) } return string(enc) }  | 
<
 
<
<
<
<
<
<
<
<
 | 
16
17
18
19
20
21
22
23
24
25
26
27
28
29
...
145
146
147
148
149
150
151
 | 
// Manifest
//
// A file manifest is a description of a source file, produced by an
// authority who signs the manifest to produce testimony.
package model
import (
	"fmt"
	"io"
	"os"
	"strings"
	"time"
)
................................................................................
	for _, m := range this.Message {
		if len(m) > messageLength {
			return fmt.Errorf("message length (%d) exceeds limit (%d)", len(m), messageLength)
		}
	}
	return nil
}
 |