Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
unknwon committed Sep 9, 2024
1 parent e3fa68c commit 5c2c5c6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 43 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v2
with:
Expand All @@ -33,16 +33,16 @@ jobs:
name: Test
strategy:
matrix:
go-version: [ 1.18.x, 1.19.x, 1.20.x ]
go-version: [ 1.22.x, 1.23.x ]
platform: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run tests with coverage
run: go test -v -race -coverprofile=coverage -covermode=atomic ./...
- name: Upload coverage report to Codecov
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/lsif.yml

This file was deleted.

3 changes: 1 addition & 2 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"encoding/hex"
"html/template"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"net/url"
Expand Down Expand Up @@ -49,7 +48,7 @@ type RequestBody struct {

// Bytes reads and returns content of request body in bytes.
func (rb *RequestBody) Bytes() ([]byte, error) {
return ioutil.ReadAll(rb.reader)
return io.ReadAll(rb.reader)
}

// String reads and returns content of request body in string.
Expand Down
6 changes: 3 additions & 3 deletions context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package macaron

import (
"bytes"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"net/url"
Expand All @@ -41,7 +41,7 @@ func Test_Context(t *testing.T) {

Convey("Get request body", func() {
m.Get("/body1", func(ctx *Context) {
data, err := ioutil.ReadAll(ctx.Req.Body().ReadCloser())
data, err := io.ReadAll(ctx.Req.Body().ReadCloser())
So(err, ShouldBeNil)
So(string(data), ShouldEqual, "This is my request body")
})
Expand All @@ -64,7 +64,7 @@ func Test_Context(t *testing.T) {
for i := 1; i <= 4; i++ {
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/body"+com.ToStr(i), nil)
req.Body = ioutil.NopCloser(bytes.NewBufferString("This is my request body"))
req.Body = io.NopCloser(bytes.NewBufferString("This is my request body"))
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
}
Expand Down
4 changes: 2 additions & 2 deletions recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package macaron
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"runtime"

"github.com/go-macaron/inject"
Expand Down Expand Up @@ -85,7 +85,7 @@ func stack(skip int) []byte {
// Print this much at least. If we can't find the source, it won't show.
fmt.Fprintf(buf, "%s:%d (0x%x)\n", file, line, pc)
if file != lastFile {
data, err := ioutil.ReadFile(file)
data, err := os.ReadFile(file)
if err != nil {
continue
}
Expand Down
3 changes: 1 addition & 2 deletions render.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"fmt"
"html/template"
"io"
"io/ioutil"
"net/http"
"os"
"path"
Expand Down Expand Up @@ -223,7 +222,7 @@ func NewTemplateFileSystem(opt RenderOptions, omitData bool) TplFileSystem {
continue
}

data, err = ioutil.ReadFile(path)
data, err = os.ReadFile(path)
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions static_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package macaron
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
Expand Down Expand Up @@ -68,7 +67,7 @@ func Test_Static(t *testing.T) {

Convey("Serve static files with local path", t, func() {
Root = os.TempDir()
f, err := ioutil.TempFile(Root, "static_content")
f, err := os.CreateTemp(Root, "static_content")
So(err, ShouldBeNil)
_, _ = f.WriteString("Expected Content")
f.Close()
Expand Down

0 comments on commit 5c2c5c6

Please sign in to comment.