ROOTPLOIT
Server: LiteSpeed
System: Linux in-mum-web1878.main-hosting.eu 5.14.0-570.21.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 11 07:22:35 EDT 2025 x86_64
User: u435929562 (435929562)
PHP: 7.4.33
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/golang/1.22.0/src/cmd/go/testdata/script/test_flag.txt
[short] skip

go test flag_test.go -v -args -v=7 # Two distinct -v flags
go test -v flag_test.go -args -v=7 # Two distinct -v flags

# Using a custom flag mixed with regular 'go test' flags should be OK.
go test -count=1 -custom -args -v=7

# However, it should be an error to use custom flags when -c is used,
# since we know for sure that no test binary will run at all.
! go test -c -custom
stderr '^go: unknown flag -custom cannot be used with -c$'

# The same should apply even if -c comes after a custom flag.
! go test -custom -c
stderr '^go: unknown flag -custom cannot be used with -c$'

-- go.mod --
module m
-- flag_test.go --
package flag_test

import (
	"flag"
	"log"
	"testing"
)

var v = flag.Int("v", 0, "v flag")

var custom = flag.Bool("custom", false, "")

// Run this as go test pkg -v=7
func TestVFlagIsSet(t *testing.T) {
	if *v != 7 {
		log.Fatal("v flag not set")
	}
}