Skip to content

net/url: url.Values.Encode uses = for empty value in key=value #30025

@nathj07

Description

@nathj07

What version of Go are you using (go version)?

$ go version
go version go1.10.3 darwin/amd64

Also

go version go1.10.3 linux/amd64

Does this issue reproduce with the latest release?

I haven't tried the latest release directly I have tried on the playground though: https://play.golang.org/p/LSBliQAmXLc

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ndavies/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ndavies/Projects/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/nf/fhhgkcvd737ggxqm3_f4tlb0nst21y/T/go-build800209626=/tmp/go-build -gno-record-gcc-switches -fno-common"

And..

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ndavies/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ndavies/dev/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build955487558=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://play.golang.org/p/LSBliQAmXLc

What did you expect to see?

I would expect the URL to not have the trailing =

What did you see instead?

There is a trailing =

This of course may be down to the owner of the site in question (anonymised in the playground) not having a fully valid URL - a query string key with no value. Though from my reading of https://tools.ietf.org/html/rfc3986#section-3.4 that seems valid if a little unconventional

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions