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

go version go1.22.3 darwin/arm64

Does this issue reproduce with the latest release?

Yes

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

GO111MODULE='on' GOARCH='arm64' GOBIN='/Users/syacko/workspace//bin' GOCACHE='/Users/syacko/Library/Caches/go-build' GOENV='/Users/syacko/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='arm64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/Users/syacko/workspace/pkg/mod' GONOPROXY='github.com/STY-Holdings/' GONOSUMDB='github.com/STY-Holdings/' GOOS='darwin' GOPATH='/Users/syacko/workspace' GOPRIVATE='github.com/STY-Holdings/*' GOPROXY='direct' GOROOT='/usr/local/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64' GOVCS='' GOVERSION='go1.22.3' GCCGO='gccgo' AR='ar' CC='clang' CXX='clang++' CGO_ENABLED='1' GOMOD='/Users/syacko/workspace/sty-holdings/GriesPikeThomp/servers/connect-server/go.mod' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/ns/swbzchzn607g4hgh4gr1qfcm0000gn/T/go-build1036544807=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

json.MarshalIndent(baseConfig, ctv.SPACES_FIVE, ctv.SPACES_TWO)

What did you expect to see?

     {  <== Five spaces prefixed.
       "cloud_providers": {
         "aws_account_info_filename": "/Volumes/development-share/.keys/sty-holdings.net/local/AWS-account-info.json",
         "gcp_credential_filename": "/Volumes/development-share/.keys/com.styholdings.dkanswers/google/service-account-key/dkanswers-key.json"
       },
       "ConfigFQN": "",
       "debug_mode_on": true,
       "environment": "local",
       "load_extensions": [
         {
           "name": "nc-internal",
           "config_filename": "/Users/syacko/workspace/sty-holdings/GriesPikeThomp/servers/connect-server/config/mac-nc-internal-config.json"
         },
         {
           "name": "stripe",
           "config_filename": "/Users/syacko/workspace/sty-holdings/GriesPikeThomp/servers/connect-server/config/mac-stripe-config.json"
         }
       ],
       "log_directory": "logs",
       "max_threads": 5,
       "pid_directory": ".run",
       "server_instance_number": "",
       "skeleton_config_directory": "/Users/syacko/workspace/sty-holdings/GriesPikeThomp/servers/connect-server/skeletons"
     }

What did you see instead?

{ <=== No Prefix
       "cloud_providers": {
         "aws_account_info_filename": "/Volumes/development-share/.keys/sty-holdings.net/local/AWS-account-info.json",
         "gcp_credential_filename": "/Volumes/development-share/.keys/com.styholdings.dkanswers/google/service-account-key/dkanswers-key.json"
       },
       "ConfigFQN": "",
       "debug_mode_on": true,
       "environment": "local",
       "load_extensions": [
         {
           "name": "nc-internal",
           "config_filename": "/Users/syacko/workspace/sty-holdings/GriesPikeThomp/servers/connect-server/config/mac-nc-internal-config.json"
         },
         {
           "name": "stripe",
           "config_filename": "/Users/syacko/workspace/sty-holdings/GriesPikeThomp/servers/connect-server/config/mac-stripe-config.json"
         }
       ],
       "log_directory": "logs",
       "max_threads": 5,
       "pid_directory": ".run",
       "server_instance_number": "",
       "skeleton_config_directory": "/Users/syacko/workspace/sty-holdings/GriesPikeThomp/servers/connect-server/skeletons"
     }

Comment From: gabyhelp

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

Comment From: sty-holdings

I disagree with https://github.com/golang/go/issues/49261. All lines of the JSON structure should be indented otherwise this is a side effect/hidden behavior.

Comment From: seankhliao

This is working as intended and documented, we cannot change this:

The data appended to dst does not begin with the prefix nor any indentation, to make it easier to embed inside other formatted JSON data.