Text file src/cmd/go/testdata/script/vet_asm.txt

     1  # Issue 27665. Verify that "go vet" analyzes non-Go files.
     2  
     3  env GO111MODULE=off
     4  env GOARCH=amd64
     5  env GOOS=linux
     6  
     7  ! go vet -asmdecl a
     8  stderr 'f: invalid MOVW of x'
     9  
    10  # -c=n flag shows n lines of context
    11  ! go vet -c=2 -asmdecl a
    12  stderr '...invalid MOVW...'
    13  stderr '1	.*TEXT'
    14  stderr '2		MOVW'
    15  stderr '3		RET'
    16  stderr '4'
    17  
    18  # -json causes success, even with diagnostics and errors,
    19  # and writes to stdout.
    20  go vet -json -asmdecl a
    21  stdout '"a": {'
    22  stdout   '"asmdecl":'
    23  stdout     '"posn": ".*asm.s:2:1",'
    24  stdout     '"message": ".*invalid MOVW.*"'
    25  
    26  -- a/a.go --
    27  package a
    28  
    29  func f(x int8)
    30  
    31  -- a/asm.s --
    32  TEXT ·f(SB),0,$0-1
    33  	MOVW	x+0(FP), AX
    34  	RET
    35  

View as plain text