diff --git a/command.go b/command.go index 4697eb1a1..fa3916230 100644 --- a/command.go +++ b/command.go @@ -654,7 +654,7 @@ func ExecuteSourceTape(c parser.Command, v *VHS) error { cmd.Type == token.OUTPUT { continue } - fmt.Fprintf(out, "%s %s\n", GrayStyle.Render(displayPath+":"), Highlight(cmd, false)) + _, _ = fmt.Fprintf(out, "%s %s\n", GrayStyle.Render(displayPath+":"), Highlight(cmd, false)) err := CommandFuncs[cmd.Type](cmd, v) if err != nil { return fmt.Errorf("failed to execute command %s: %w", cmd.Type.String(), err) diff --git a/error.go b/error.go index 8c7c470da..3163c622e 100644 --- a/error.go +++ b/error.go @@ -35,11 +35,11 @@ func LineNumber(line int) string { func printError(out io.Writer, tape string, err parser.Error) { lines := strings.Split(tape, "\n") - fmt.Fprint(out, LineNumber(err.Token.Line)) - fmt.Fprintln(out, lines[err.Token.Line-1]) - fmt.Fprint(out, strings.Repeat(" ", err.Token.Column+ErrorColumnOffset)) - fmt.Fprintln(out, Underline(len(err.Token.Literal)), err.Msg) - fmt.Fprintln(out) + _, _ = fmt.Fprint(out, LineNumber(err.Token.Line)) + _, _ = fmt.Fprintln(out, lines[err.Token.Line-1]) + _, _ = fmt.Fprint(out, strings.Repeat(" ", err.Token.Column+ErrorColumnOffset)) + _, _ = fmt.Fprintln(out, Underline(len(err.Token.Literal)), err.Msg) + _, _ = fmt.Fprintln(out) } func printErrors(out io.Writer, tape string, errs []error) { @@ -49,10 +49,10 @@ func printErrors(out io.Writer, tape string, errs []error) { for _, v := range err.Errors { printError(out, tape, v) } - fmt.Fprintln(out, ErrorStyle.Render(err.Error())) + _, _ = fmt.Fprintln(out, ErrorStyle.Render(err.Error())) default: - fmt.Fprintln(out, ErrorStyle.Render(err.Error())) + _, _ = fmt.Fprintln(out, ErrorStyle.Render(err.Error())) } } } diff --git a/evaluator.go b/evaluator.go index 9c7a8448a..6d9fa473b 100644 --- a/evaluator.go +++ b/evaluator.go @@ -55,7 +55,7 @@ func Evaluate(ctx context.Context, tape string, out io.Writer, opts ...Evaluator var offset int for i, cmd := range cmds { if cmd.Type == token.SET || cmd.Type == token.OUTPUT || cmd.Type == token.REQUIRE { - fmt.Fprintln(out, Highlight(cmd, false)) + _, _ = fmt.Fprintln(out, Highlight(cmd, false)) if cmd.Options != "Shell" { err := Execute(cmd, &v) if err != nil { @@ -101,7 +101,7 @@ func Evaluate(ctx context.Context, tape string, out io.Writer, opts ...Evaluator offset += i break } - fmt.Fprintln(out, Highlight(cmd, true)) + _, _ = fmt.Fprintln(out, Highlight(cmd, true)) err := Execute(cmd, &v) if err != nil { return []error{err} @@ -153,10 +153,10 @@ func Evaluate(ctx context.Context, tape string, out io.Writer, opts ...Evaluator // We should remove if isSetting statement. isSetting := cmd.Type == token.SET && cmd.Options != "TypingSpeed" if isSetting || cmd.Type == token.REQUIRE { - fmt.Fprintln(out, Highlight(cmd, true)) + _, _ = fmt.Fprintln(out, Highlight(cmd, true)) continue } - fmt.Fprintln(out, Highlight(cmd, !v.recording || cmd.Type == token.SHOW || cmd.Type == token.HIDE || isSetting)) + _, _ = fmt.Fprintln(out, Highlight(cmd, !v.recording || cmd.Type == token.SHOW || cmd.Type == token.HIDE || isSetting)) err := Execute(cmd, &v) if err != nil { teardown() diff --git a/publish.go b/publish.go index 4c4605881..f864c365a 100644 --- a/publish.go +++ b/publish.go @@ -88,7 +88,7 @@ func hostKeyCallback(path string) ssh.HostKeyCallback { return fmt.Errorf("possible man-in-the-middle attack: %w", err) } // if want is empty, it means the host was not in the known_hosts file, so lets add it there. - fmt.Fprintln(kh, knownhosts.Line([]string{hostname}, key)) + _, _ = fmt.Fprintln(kh, knownhosts.Line([]string{hostname}, key)) return nil } return fmt.Errorf("failed to check known_hosts: %w", err) diff --git a/record.go b/record.go index 13d440b53..cafac682c 100644 --- a/record.go +++ b/record.go @@ -81,7 +81,7 @@ func Record(_ *cobra.Command, _ []string) error { log.Printf("error resizing pty: %s", err) } - prevState, err := term.MakeRaw(int(os.Stdin.Fd())) + prevState, err := term.MakeRaw(int(os.Stdin.Fd())) //nolint: gosec if err != nil { return err } @@ -114,7 +114,7 @@ func Record(_ *cobra.Command, _ []string) error { // PTY cleanup and restore terminal _ = terminal.Close() - _ = term.Restore(int(os.Stdin.Fd()), prevState) + _ = term.Restore(int(os.Stdin.Fd()), prevState) //nolint: gosec fmt.Println(inputToTape(tape.String())) return nil diff --git a/vhs.go b/vhs.go index 66a72e554..b0a81ef5c 100644 --- a/vhs.go +++ b/vhs.go @@ -349,7 +349,7 @@ func (vhs *VHS) Record(ctx context.Context) <-chan error { if err := os.WriteFile( filepath.Join(vhs.Options.Video.Input, fmt.Sprintf(cursorFrameFormat, counter)), cursor, - os.ModePerm, + 0o600, ); err != nil { ch <- fmt.Errorf("error writing cursor frame: %w", err) continue @@ -357,7 +357,7 @@ func (vhs *VHS) Record(ctx context.Context) <-chan error { if err := os.WriteFile( filepath.Join(vhs.Options.Video.Input, fmt.Sprintf(textFrameFormat, counter)), text, - os.ModePerm, + 0o600, ); err != nil { ch <- fmt.Errorf("error writing text frame: %w", err) continue