We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go version
$ go version go version go1.18 linux/amd64
Yes
go env
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/me/.cache/go-build" GOENV="/home/me/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/me/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/me/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/lib/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.18" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/me/project/go.mod" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build697837538=/tmp/go-build -gno-record-gcc-switches"
package main import ( "fmt" "mime" ) func main() { val, err := mime.ExtensionsByType("text/plain") if err != nil { panic(err) } fmt.Printf("%+v", val) }
Definitely not ,v as a valid extension
,v
[,v .asc .inf .ini .txt]
The text was updated successfully, but these errors were encountered:
Hi @PetitCassoulet - Per the docs, on Linux following files are checked for the mime types database:
var mimeGlobs = []string{ "/usr/local/share/mime/globs2", "/usr/share/mime/globs2", } var typeFiles = []string{ "/etc/mime.types", "/etc/apache2/mime.types", "/etc/apache/mime.types", "/etc/httpd/conf/mime.types", }
Source: https://cs.opensource.google/go/go/+/refs/tags/go1.18:src/mime/type_unix.go;l=19-32
Maybe one of these is corrupted in your system? I get the correct output both with 1.17 and current tip on a macos system.
Thanks!
EDIT: reproduced on an Ubuntu container. Go got the ,v from /usr/share/mime/globs2:
/usr/share/mime/globs2
# cat /usr/share/mime/globs2 | grep ",v" 50:text/plain:*,v
Container version:
# cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"
Sorry, something went wrong.
As noted above, mime types are provided by the underlying system, and it looks like this was an intentional addition by OS maintainers: https://unix.stackexchange.com/questions/666614/reason-for-text-plain-pattern-v-in-shared-mime-info
Closing as there's nothing to do in Go.
No branches or pull requests
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Definitely not
,v
as a valid extensionWhat did you see instead?
[,v .asc .inf .ini .txt]
The text was updated successfully, but these errors were encountered: