forked from Mirrors/bubbletea
docs: fix lint issues in examples and tutorials (#759)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
b2d2ac6504
commit
b80eb8303b
|
@ -18,13 +18,13 @@ const (
|
||||||
fps = 60
|
fps = 60
|
||||||
frequency = 7.5
|
frequency = 7.5
|
||||||
damping = 0.15
|
damping = 0.15
|
||||||
|
asterisk = "*"
|
||||||
)
|
)
|
||||||
|
|
||||||
func drawEllipse(cb *cellbuffer, xc, yc, rx, ry float64) {
|
func drawEllipse(cb *cellbuffer, xc, yc, rx, ry float64) {
|
||||||
const c = "*"
|
|
||||||
var (
|
var (
|
||||||
dx, dy, d1, d2 float64
|
dx, dy, d1, d2 float64
|
||||||
x float64 = 0
|
x float64
|
||||||
y = ry
|
y = ry
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -33,10 +33,10 @@ func drawEllipse(cb *cellbuffer, xc, yc, rx, ry float64) {
|
||||||
dy = 2 * rx * rx * y
|
dy = 2 * rx * rx * y
|
||||||
|
|
||||||
for dx < dy {
|
for dx < dy {
|
||||||
cb.set(c, int(x+xc), int(y+yc))
|
cb.set(int(x+xc), int(y+yc))
|
||||||
cb.set(c, int(-x+xc), int(y+yc))
|
cb.set(int(-x+xc), int(y+yc))
|
||||||
cb.set(c, int(x+xc), int(-y+yc))
|
cb.set(int(x+xc), int(-y+yc))
|
||||||
cb.set(c, int(-x+xc), int(-y+yc))
|
cb.set(int(-x+xc), int(-y+yc))
|
||||||
if d1 < 0 {
|
if d1 < 0 {
|
||||||
x++
|
x++
|
||||||
dx = dx + (2 * ry * ry)
|
dx = dx + (2 * ry * ry)
|
||||||
|
@ -53,10 +53,10 @@ func drawEllipse(cb *cellbuffer, xc, yc, rx, ry float64) {
|
||||||
d2 = ((ry * ry) * ((x + 0.5) * (x + 0.5))) + ((rx * rx) * ((y - 1) * (y - 1))) - (rx * rx * ry * ry)
|
d2 = ((ry * ry) * ((x + 0.5) * (x + 0.5))) + ((rx * rx) * ((y - 1) * (y - 1))) - (rx * rx * ry * ry)
|
||||||
|
|
||||||
for y >= 0 {
|
for y >= 0 {
|
||||||
cb.set(c, int(x+xc), int(y+yc))
|
cb.set(int(x+xc), int(y+yc))
|
||||||
cb.set(c, int(-x+xc), int(y+yc))
|
cb.set(int(-x+xc), int(y+yc))
|
||||||
cb.set(c, int(x+xc), int(-y+yc))
|
cb.set(int(x+xc), int(-y+yc))
|
||||||
cb.set(c, int(-x+xc), int(-y+yc))
|
cb.set(int(-x+xc), int(-y+yc))
|
||||||
if d2 > 0 {
|
if d2 > 0 {
|
||||||
y--
|
y--
|
||||||
dy = dy - (2 * rx * rx)
|
dy = dy - (2 * rx * rx)
|
||||||
|
@ -85,16 +85,12 @@ func (c *cellbuffer) init(w, h int) {
|
||||||
c.wipe()
|
c.wipe()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c cellbuffer) set(v string, x, y int) {
|
func (c cellbuffer) set(x, y int) {
|
||||||
i := y*c.stride + x
|
i := y*c.stride + x
|
||||||
if i > len(c.cells)-1 || x < 0 || y < 0 || x >= c.width() || y >= c.height() {
|
if i > len(c.cells)-1 || x < 0 || y < 0 || x >= c.width() || y >= c.height() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.cells[i] = v
|
c.cells[i] = asterisk
|
||||||
}
|
|
||||||
|
|
||||||
func (c *cellbuffer) clear(x, y int) {
|
|
||||||
c.set(" ", x, y)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cellbuffer) wipe() {
|
func (c *cellbuffer) wipe() {
|
||||||
|
|
|
@ -98,7 +98,7 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
} else {
|
} else {
|
||||||
m.Next()
|
m.Next()
|
||||||
m.resetSpinner()
|
m.resetSpinner()
|
||||||
cmds = append(cmds, spinner.Tick)
|
cmds = append(cmds, m.spinner.Tick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch m.state {
|
switch m.state {
|
||||||
|
|
|
@ -132,12 +132,12 @@ func (m model) View() string {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if os.Getenv("HELP_DEBUG") != "" {
|
if os.Getenv("HELP_DEBUG") != "" {
|
||||||
if f, err := tea.LogToFile("debug.log", "help"); err != nil {
|
f, err := tea.LogToFile("debug.log", "help")
|
||||||
|
if err != nil {
|
||||||
fmt.Println("Couldn't open a file for logging:", err)
|
fmt.Println("Couldn't open a file for logging:", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
} else {
|
|
||||||
defer f.Close()
|
|
||||||
}
|
}
|
||||||
|
defer f.Close() // nolint:errcheck
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := tea.NewProgram(newModel()).Run(); err != nil {
|
if _, err := tea.NewProgram(newModel()).Run(); err != nil {
|
||||||
|
|
|
@ -76,7 +76,7 @@ func checkServer() tea.Msg {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errMsg{err}
|
return errMsg{err}
|
||||||
}
|
}
|
||||||
defer res.Body.Close()
|
defer res.Body.Close() // nolint:errcheck
|
||||||
|
|
||||||
return statusMsg(res.StatusCode)
|
return statusMsg(res.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ type itemDelegate struct{}
|
||||||
|
|
||||||
func (d itemDelegate) Height() int { return 1 }
|
func (d itemDelegate) Height() int { return 1 }
|
||||||
func (d itemDelegate) Spacing() int { return 0 }
|
func (d itemDelegate) Spacing() int { return 0 }
|
||||||
func (d itemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd { return nil }
|
func (d itemDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd { return nil }
|
||||||
func (d itemDelegate) Render(w io.Writer, m list.Model, index int, listItem list.Item) {
|
func (d itemDelegate) Render(w io.Writer, m list.Model, index int, listItem list.Item) {
|
||||||
i, ok := listItem.(item)
|
i, ok := listItem.(item)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
@ -115,7 +115,7 @@ type installedPkgMsg string
|
||||||
func downloadAndInstall(pkg string) tea.Cmd {
|
func downloadAndInstall(pkg string) tea.Cmd {
|
||||||
// This is where you'd do i/o stuff to download and install packages. In
|
// This is where you'd do i/o stuff to download and install packages. In
|
||||||
// our case we're just pausing for a moment to simulate the process.
|
// our case we're just pausing for a moment to simulate the process.
|
||||||
d := time.Millisecond * time.Duration(rand.Intn(500))
|
d := time.Millisecond * time.Duration(rand.Intn(500)) //nolint:gosec
|
||||||
return tea.Tick(d, func(t time.Time) tea.Msg {
|
return tea.Tick(d, func(t time.Time) tea.Msg {
|
||||||
return installedPkgMsg(pkg)
|
return installedPkgMsg(pkg)
|
||||||
})
|
})
|
||||||
|
@ -129,8 +129,6 @@ func max(a, b int) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
rand.Seed(time.Now().Unix())
|
|
||||||
|
|
||||||
if _, err := tea.NewProgram(newModel()).Run(); err != nil {
|
if _, err := tea.NewProgram(newModel()).Run(); err != nil {
|
||||||
fmt.Println("Error running program:", err)
|
fmt.Println("Error running program:", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
|
@ -46,7 +46,7 @@ func getPackages() []string {
|
||||||
})
|
})
|
||||||
|
|
||||||
for k := range pkgs {
|
for k := range pkgs {
|
||||||
pkgs[k] += fmt.Sprintf("-%d.%d.%d", rand.Intn(10), rand.Intn(10), rand.Intn(10))
|
pkgs[k] += fmt.Sprintf("-%d.%d.%d", rand.Intn(10), rand.Intn(10), rand.Intn(10)) //nolint:gosec
|
||||||
}
|
}
|
||||||
return pkgs
|
return pkgs
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ type model struct {
|
||||||
func newModel(initialValue string) (m model) {
|
func newModel(initialValue string) (m model) {
|
||||||
i := textinput.New()
|
i := textinput.New()
|
||||||
i.Prompt = ""
|
i.Prompt = ""
|
||||||
i.CursorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("63"))
|
i.Cursor.Style = lipgloss.NewStyle().Foreground(lipgloss.Color("63"))
|
||||||
i.Width = 48
|
i.Width = 48
|
||||||
i.SetValue(initialValue)
|
i.SetValue(initialValue)
|
||||||
i.CursorEnd()
|
i.CursorEnd()
|
||||||
|
|
|
@ -61,7 +61,7 @@ func initialModel() model {
|
||||||
|
|
||||||
return model{
|
return model{
|
||||||
textarea: ti,
|
textarea: ti,
|
||||||
help: help.NewModel(),
|
help: help.New(),
|
||||||
keymap: keymap{
|
keymap: keymap{
|
||||||
save: key.NewBinding(
|
save: key.NewBinding(
|
||||||
key.WithKeys("ctrl+s"),
|
key.WithKeys("ctrl+s"),
|
||||||
|
|
|
@ -40,7 +40,7 @@ func (pw *progressWriter) Write(p []byte) (int, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getResponse(url string) (*http.Response, error) {
|
func getResponse(url string) (*http.Response, error) {
|
||||||
resp, err := http.Get(url)
|
resp, err := http.Get(url) // nolint:gosec
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ func main() {
|
||||||
fmt.Println("could not get response", err)
|
fmt.Println("could not get response", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close() // nolint:errcheck
|
||||||
|
|
||||||
// Don't add TUI if the header doesn't include content size
|
// Don't add TUI if the header doesn't include content size
|
||||||
// it's impossible see progress without total
|
// it's impossible see progress without total
|
||||||
|
@ -79,7 +79,7 @@ func main() {
|
||||||
fmt.Println("could not create file:", err)
|
fmt.Println("could not create file:", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close() // nolint:errcheck
|
||||||
|
|
||||||
pw := &progressWriter{
|
pw := &progressWriter{
|
||||||
total: int(resp.ContentLength),
|
total: int(resp.ContentLength),
|
||||||
|
|
|
@ -24,7 +24,7 @@ type responseMsg struct{}
|
||||||
func listenForActivity(sub chan struct{}) tea.Cmd {
|
func listenForActivity(sub chan struct{}) tea.Cmd {
|
||||||
return func() tea.Msg {
|
return func() tea.Msg {
|
||||||
for {
|
for {
|
||||||
time.Sleep(time.Millisecond * time.Duration(rand.Int63n(900)+100))
|
time.Sleep(time.Millisecond * time.Duration(rand.Int63n(900)+100)) // nolint:gosec
|
||||||
sub <- struct{}{}
|
sub <- struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ type model struct {
|
||||||
|
|
||||||
func (m model) Init() tea.Cmd {
|
func (m model) Init() tea.Cmd {
|
||||||
return tea.Batch(
|
return tea.Batch(
|
||||||
spinner.Tick,
|
m.spinner.Tick,
|
||||||
listenForActivity(m.sub), // generate activity
|
listenForActivity(m.sub), // generate activity
|
||||||
waitForActivity(m.sub), // wait for activity
|
waitForActivity(m.sub), // wait for activity
|
||||||
)
|
)
|
||||||
|
@ -78,8 +78,6 @@ func (m model) View() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
rand.Seed(time.Now().UTC().UnixNano())
|
|
||||||
|
|
||||||
p := tea.NewProgram(model{
|
p := tea.NewProgram(model{
|
||||||
sub: make(chan struct{}),
|
sub: make(chan struct{}),
|
||||||
spinner: spinner.New(),
|
spinner: spinner.New(),
|
||||||
|
|
|
@ -53,7 +53,7 @@ func newModel() model {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m model) Init() tea.Cmd {
|
func (m model) Init() tea.Cmd {
|
||||||
return spinner.Tick
|
return m.spinner.Tick
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
|
@ -100,14 +100,12 @@ func (m model) View() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
rand.Seed(time.Now().UTC().UnixNano())
|
|
||||||
|
|
||||||
p := tea.NewProgram(newModel())
|
p := tea.NewProgram(newModel())
|
||||||
|
|
||||||
// Simulate activity
|
// Simulate activity
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
pause := time.Duration(rand.Int63n(899)+100) * time.Millisecond
|
pause := time.Duration(rand.Int63n(899)+100) * time.Millisecond // nolint:gosec
|
||||||
time.Sleep(pause)
|
time.Sleep(pause)
|
||||||
|
|
||||||
// Send the Bubble Tea program a message from outside the
|
// Send the Bubble Tea program a message from outside the
|
||||||
|
@ -129,5 +127,5 @@ func randomFood() string {
|
||||||
"a kohlrabi", "some spaghetti", "tacos", "a currywurst", "some curry",
|
"a kohlrabi", "some spaghetti", "tacos", "a currywurst", "some curry",
|
||||||
"a sandwich", "some peanut butter", "some cashews", "some ramen",
|
"a sandwich", "some peanut butter", "some cashews", "some ramen",
|
||||||
}
|
}
|
||||||
return string(food[rand.Intn(len(food))])
|
return food[rand.Intn(len(food))] // nolint:gosec
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ func main() {
|
||||||
key.WithHelp("q", "quit"),
|
key.WithHelp("q", "quit"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
help: help.NewModel(),
|
help: help.New(),
|
||||||
}
|
}
|
||||||
|
|
||||||
m.keymap.start.SetEnabled(false)
|
m.keymap.start.SetEnabled(false)
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/charmbracelet/bubbles/cursor"
|
||||||
"github.com/charmbracelet/bubbles/textinput"
|
"github.com/charmbracelet/bubbles/textinput"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
|
@ -28,7 +29,7 @@ var (
|
||||||
type model struct {
|
type model struct {
|
||||||
focusIndex int
|
focusIndex int
|
||||||
inputs []textinput.Model
|
inputs []textinput.Model
|
||||||
cursorMode textinput.CursorMode
|
cursorMode cursor.Mode
|
||||||
}
|
}
|
||||||
|
|
||||||
func initialModel() model {
|
func initialModel() model {
|
||||||
|
@ -39,7 +40,7 @@ func initialModel() model {
|
||||||
var t textinput.Model
|
var t textinput.Model
|
||||||
for i := range m.inputs {
|
for i := range m.inputs {
|
||||||
t = textinput.New()
|
t = textinput.New()
|
||||||
t.CursorStyle = cursorStyle
|
t.Cursor.Style = cursorStyle
|
||||||
t.CharLimit = 32
|
t.CharLimit = 32
|
||||||
|
|
||||||
switch i {
|
switch i {
|
||||||
|
@ -77,12 +78,12 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
// Change cursor mode
|
// Change cursor mode
|
||||||
case "ctrl+r":
|
case "ctrl+r":
|
||||||
m.cursorMode++
|
m.cursorMode++
|
||||||
if m.cursorMode > textinput.CursorHide {
|
if m.cursorMode > cursor.CursorHide {
|
||||||
m.cursorMode = textinput.CursorBlink
|
m.cursorMode = cursor.CursorBlink
|
||||||
}
|
}
|
||||||
cmds := make([]tea.Cmd, len(m.inputs))
|
cmds := make([]tea.Cmd, len(m.inputs))
|
||||||
for i := range m.inputs {
|
for i := range m.inputs {
|
||||||
cmds[i] = m.inputs[i].SetCursorMode(m.cursorMode)
|
cmds[i] = m.inputs[i].Cursor.SetMode(m.cursorMode)
|
||||||
}
|
}
|
||||||
return m, tea.Batch(cmds...)
|
return m, tea.Batch(cmds...)
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ func main() {
|
||||||
key.WithHelp("q", "quit"),
|
key.WithHelp("q", "quit"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
help: help.NewModel(),
|
help: help.New(),
|
||||||
}
|
}
|
||||||
m.keymap.start.SetEnabled(false)
|
m.keymap.start.SetEnabled(false)
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@ import (
|
||||||
var helpStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("241")).Render
|
var helpStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("241")).Render
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
rand.Seed(time.Now().UTC().UnixNano())
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
daemonMode bool
|
daemonMode bool
|
||||||
showHelp bool
|
showHelp bool
|
||||||
|
@ -77,7 +75,7 @@ func newModel() model {
|
||||||
func (m model) Init() tea.Cmd {
|
func (m model) Init() tea.Cmd {
|
||||||
log.Println("Starting work...")
|
log.Println("Starting work...")
|
||||||
return tea.Batch(
|
return tea.Batch(
|
||||||
spinner.Tick,
|
m.spinner.Tick,
|
||||||
runPretendProcess,
|
runPretendProcess,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -128,12 +126,12 @@ type processFinishedMsg time.Duration
|
||||||
|
|
||||||
// pretendProcess simulates a long-running process.
|
// pretendProcess simulates a long-running process.
|
||||||
func runPretendProcess() tea.Msg {
|
func runPretendProcess() tea.Msg {
|
||||||
pause := time.Duration(rand.Int63n(899)+100) * time.Millisecond
|
pause := time.Duration(rand.Int63n(899)+100) * time.Millisecond // nolint:gosec
|
||||||
time.Sleep(pause)
|
time.Sleep(pause)
|
||||||
return processFinishedMsg(pause)
|
return processFinishedMsg(pause)
|
||||||
}
|
}
|
||||||
|
|
||||||
func randomEmoji() string {
|
func randomEmoji() string {
|
||||||
emojis := []rune("🍦🧋🍡🤠👾😭🦊🐯🦆🥨🎏🍔🍒🍥🎮📦🦁🐶🐸🍕🥐🧲🚒🥇🏆🌽")
|
emojis := []rune("🍦🧋🍡🤠👾😭🦊🐯🦆🥨🎏🍔🍒🍥🎮📦🦁🐶🐸🍕🥐🧲🚒🥇🏆🌽")
|
||||||
return string(emojis[rand.Intn(len(emojis))])
|
return string(emojis[rand.Intn(len(emojis))]) // nolint:gosec
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,7 @@ func chosenView(m model) string {
|
||||||
label = fmt.Sprintf("Downloaded. Exiting in %s seconds...", colorFg(strconv.Itoa(m.Ticks), "79"))
|
label = fmt.Sprintf("Downloaded. Exiting in %s seconds...", colorFg(strconv.Itoa(m.Ticks), "79"))
|
||||||
}
|
}
|
||||||
|
|
||||||
return msg + "\n\n" + label + "\n" + progressbar(80, m.Progress) + "%"
|
return msg + "\n\n" + label + "\n" + progressbar(m.Progress) + "%"
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkbox(label string, checked bool) string {
|
func checkbox(label string, checked bool) string {
|
||||||
|
@ -226,7 +226,7 @@ func checkbox(label string, checked bool) string {
|
||||||
return fmt.Sprintf("[ ] %s", label)
|
return fmt.Sprintf("[ ] %s", label)
|
||||||
}
|
}
|
||||||
|
|
||||||
func progressbar(width int, percent float64) string {
|
func progressbar(percent float64) string {
|
||||||
w := float64(progressBarWidth)
|
w := float64(progressBarWidth)
|
||||||
|
|
||||||
fullSize := int(math.Round(w * percent))
|
fullSize := int(math.Round(w * percent))
|
||||||
|
@ -253,14 +253,6 @@ func makeFgStyle(color string) func(string) string {
|
||||||
return termenv.Style{}.Foreground(term.Color(color)).Styled
|
return termenv.Style{}.Foreground(term.Color(color)).Styled
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color a string's foreground and background with the given value.
|
|
||||||
func makeFgBgStyle(fg, bg string) func(string) string {
|
|
||||||
return termenv.Style{}.
|
|
||||||
Foreground(term.Color(fg)).
|
|
||||||
Background(term.Color(bg)).
|
|
||||||
Styled
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate a blend of colors.
|
// Generate a blend of colors.
|
||||||
func makeRamp(colorA, colorB string, steps float64) (s []string) {
|
func makeRamp(colorA, colorB string, steps float64) (s []string) {
|
||||||
cA, _ := colorful.Hex(colorA)
|
cA, _ := colorful.Hex(colorA)
|
||||||
|
|
|
@ -22,7 +22,7 @@ func checkServer() tea.Msg {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errMsg{err}
|
return errMsg{err}
|
||||||
}
|
}
|
||||||
defer res.Body.Close()
|
defer res.Body.Close() // nolint:errcheck
|
||||||
|
|
||||||
return statusMsg(res.StatusCode)
|
return statusMsg(res.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue