git checkout v1.7.7
go test ./...

Description


## Expectations

all passed

## Actual result

```bash
=== RUN   TestContextRenderFile
    context_test.go:1008: 
            Error Trace:    context_test.go:1008
            Error:          Not equal: 
                            expected: "text/plain; charset=utf-8"
                            actual  : "text/x-go; charset=utf-8"

                            Diff:
                            --- Expected
                            +++ Actual
                            @@ -1 +1 @@
                            -text/plain; charset=utf-8
                            +text/x-go; charset=utf-8
            Test:           TestContextRenderFile
--- FAIL: TestContextRenderFile (0.00s)


Expected :text/plain; charset=utf-8
Actual   :text/x-go; charset=utf-8

=== RUN   TestContextRenderFileFromFS
    context_test.go:1020: 
            Error Trace:    context_test.go:1020
            Error:          Not equal: 
                            expected: "text/plain; charset=utf-8"
                            actual  : "text/x-go; charset=utf-8"

                            Diff:
                            --- Expected
                            +++ Actual
                            @@ -1 +1 @@
                            -text/plain; charset=utf-8
                            +text/x-go; charset=utf-8
            Test:           TestContextRenderFileFromFS
--- FAIL: TestContextRenderFileFromFS (0.00s)


Expected :text/plain; charset=utf-8
Actual   :text/x-go; charset=utf-8

Environment

  • go version: go version go1.17.3 linux/amd64
  • gin version (or commit ref): v1.7.7
  • operating system:

maybe missed https://github.com/gin-gonic/gin/commit/77649bcfee1a3eef1cc79839457ed5369916edb4 on v1.7.7

Comment From: Bisstocuz

@thinkerou

Comment From: thinkerou

  1. https://github.com/gin-gonic/gin/pull/2952 test ok
  2. on my mac, run make test ok
  3. on my mac, run go test ./... ok
➜  gin-1.7.7 go test ./...
ok      github.com/gin-gonic/gin    1.102s
ok      github.com/gin-gonic/gin/binding    0.441s
?       github.com/gin-gonic/gin/ginS   [no test files]
ok      github.com/gin-gonic/gin/internal/bytesconv 0.437s
?       github.com/gin-gonic/gin/internal/json  [no test files]
ok      github.com/gin-gonic/gin/render 0.845s

Comment From: WangLeonard

@thinkerou Hi, This test case can indeed be passed on the mac.
I reproduced it on linux.
And $GOROOT/src/mime/type.go TypeByExtension will be different return value on linux and mac
mac
Gin some test failed on v1.7.7 tags & go1.17
linux
Gin some test failed on v1.7.7 tags & go1.17
I'm not sure about the further reason for this. My environment problem or go problem or gin problem.

Comment From: shawndx

Thought it's related to a go sdk change, https://go-review.googlesource.com/c/go/+/305230, which supports "Shared MIME-info Database on Unix systems" in go1.17