Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/shelldoc/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package cmd

import (
"fmt"
"io/ioutil"
"io"
"log"
"os"

Expand Down Expand Up @@ -44,7 +44,7 @@ func initLogging() {
if verbose {
log.SetOutput(os.Stderr)
} else {
log.SetOutput(ioutil.Discard)
log.SetOutput(io.Discard)
}
log.SetFlags(0)
log.SetPrefix("Note: ")
Expand Down
3 changes: 1 addition & 2 deletions pkg/junitxml/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package junitxml

import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"runtime"
Expand All @@ -12,7 +11,7 @@ import (
)

func openTmpFile() (*os.File, error) {
file, err := ioutil.TempFile("", "write_test-*.xml")
file, err := os.CreateTemp("", "write_test-*.xml")
if err != nil {
return nil, fmt.Errorf("unable to open temporary output file: %v", err)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/run/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package run

import (
"fmt"
"io/ioutil"
"io"
"os"
)

Expand All @@ -16,15 +16,15 @@ func ReadInput(args []string) ([]byte, error) {
if len(args) > 0 {
var result []byte
for _, filename := range args {
content, err := ioutil.ReadFile(filename)
content, err := os.ReadFile(filename)
if err != nil {
return nil, fmt.Errorf("unable to read file %s", filename)
}
result = append(result, content[:]...)
}
return result, nil
}
result, err := ioutil.ReadAll(os.Stdin)
result, err := io.ReadAll(os.Stdin)
if err != nil {
if err != nil {
return nil, fmt.Errorf("unable to read from stdin: %v", err)
Expand Down
10 changes: 5 additions & 5 deletions pkg/tokenizer/tokenizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package tokenizer
// SPDX-License-Identifier: Apache-2.0

import (
"io/ioutil"
"os"
"testing"

blackfriday "github.com/russross/blackfriday/v2"
Expand All @@ -20,7 +20,7 @@ func codeBlockHandler(visitor *Visitor, node *blackfriday.Node) blackfriday.Walk
return blackfriday.GoToNext
}
func TestEchoTrue(t *testing.T) {
data, err := ioutil.ReadFile("samples/echotrue.md")
data, err := os.ReadFile("samples/echotrue.md")
require.NoError(t, err, "Unable to read sample data file")
visitor := Visitor{codeBlockHandler, codeBlockHandler, nil}
require.Zero(t, echoTrueCodeBlockCount, "Starting the counter")
Expand All @@ -29,15 +29,15 @@ func TestEchoTrue(t *testing.T) {
}

func TestTokenizeEchoTrue(t *testing.T) {
data, err := ioutil.ReadFile("samples/echotrue.md")
data, err := os.ReadFile("samples/echotrue.md")
require.NoError(t, err, "Unable to read sample data file")
visitor := NewInteractionVisitor()
Tokenize(data, visitor)
require.Equal(t, len(visitor.Interactions), 1, "There is one code block element in the sample file")
}

func TestTokenizeHelloWorld(t *testing.T) {
data, err := ioutil.ReadFile("samples/helloworld.md")
data, err := os.ReadFile("samples/helloworld.md")
require.NoError(t, err, "Unable to read sample data file")
visitor := NewInteractionVisitor()
Tokenize(data, visitor)
Expand All @@ -53,7 +53,7 @@ func TestTokenizeHelloWorld(t *testing.T) {
}

func TestTokenizeFenced(t *testing.T) {
data, err := ioutil.ReadFile("samples/fenced.md")
data, err := os.ReadFile("samples/fenced.md")
require.NoError(t, err, "Unable to read sample data file")
visitor := NewInteractionVisitor()
Tokenize(data, visitor)
Expand Down