Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e55e6ac

Browse files
umbynosper1234
andauthored
Apply suggestions from code review
Co-authored-by: per1234 <accounts@perglass.com>
1 parent 1c6c318 commit e55e6ac

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

‎arduino/errors.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ func (e *TempDirCreationFailedError) ToRPCStatus() *status.Status {
698698
return status.New(codes.Unavailable, e.Error())
699699
}
700700

701-
// FileCreationFailedError is returned if a temp file could not be created
701+
// FileCreationFailedError is returned if a file could not be created
702702
type FileCreationFailedError struct {
703703
Message string
704704
Cause error

‎cli/keys/generate.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func runGenerateCommand(command *cobra.Command, args []string) {
6767
KeysKeychain: keysKeychain,
6868
})
6969
if err != nil {
70-
feedback.Errorf(tr("Error during Generate: %v"), err)
70+
feedback.Errorf(tr("Error during generate: %v"), err)
7171
os.Exit(errorcodes.ErrGeneric)
7272
}
7373
feedback.PrintResult(result{resp})

‎commands/keys/generate.go‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,13 @@ func genEcdsaP256() ([]byte, []byte, error) {
194194
}
195195

196196
// genCFile will take a file as input, the byte slice that represents the key and the type of the key.
197-
// If will then write the file and report an error if one is found
197+
// It will then write the file and report an error if one is found
198198
func genCFile(file *os.File, bytes []byte, t string) (err error) {
199199
fileContent := fmt.Sprintf(`/* Autogenerated, do not edit */
200200
const unsigned char rsa_%s_key[] = {
201-
%s
201+
// clang-format off
202+
%s
203+
// clang-format on
202204
};
203205
const unsigned int ec_%s_key_len = %d;
204206
`, t, formatCData(bytes), t, len(bytes))
@@ -210,16 +212,17 @@ const unsigned int ec_%s_key_len = %d;
210212
// taken and adapted from https://git.furworks.de/Zephyr/mcuboot/src/commit/3869e760901a27adff47ccaea803a42f1b0169c0/imgtool/imgtool.go#L313
211213
func formatCData(data []byte) string {
212214
buf := new(bytes.Buffer)
213-
indText := strings.Repeat("\t", 1)
215+
indText := strings.Repeat("", 2)
214216
for i, b := range data {
215217
if i%8 == 0 {
216-
if i > 0 {
217-
fmt.Fprintf(buf, "\n%s", indText)
218-
}
218+
fmt.Fprintf(buf, indText)
219219
} else {
220220
fmt.Fprintf(buf, " ")
221221
}
222222
fmt.Fprintf(buf, "0x%02x,", b)
223+
if i%8 == 7 {
224+
fmt.Fprintf(buf, "\n")
225+
}
223226
}
224227
return buf.String()
225228
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /