honnef.co/go/tools@v0.4.7/staticcheck/testdata/src/example.com/CheckStrconv/CheckStrconv.go (about)

     1  package pkg
     2  
     3  import "strconv"
     4  
     5  func fn() {
     6  	strconv.ParseFloat("", 16) //@ diag(`'bitSize' argument is invalid, must be either 32 or 64`)
     7  	strconv.ParseFloat("", 32)
     8  	strconv.ParseFloat("", 64)
     9  	strconv.ParseFloat("", 128) //@ diag(`'bitSize' argument is invalid, must be either 32 or 64`)
    10  
    11  	strconv.ParseInt("", 0, -1) //@ diag(`'bitSize' argument is invalid, must be within 0 and 64`)
    12  	strconv.ParseInt("", 0, 0)
    13  	strconv.ParseInt("", 0, 1)
    14  	strconv.ParseInt("", 0, 64)
    15  	strconv.ParseInt("", 0, 65) //@ diag(`'bitSize' argument is invalid, must be within 0 and 64`)
    16  	strconv.ParseInt("", -1, 0) //@ diag(`'base' must not be smaller than 2, unless it is 0`)
    17  	strconv.ParseInt("", 1, 0)  //@ diag(`'base' must not be smaller than 2, unless it is 0`)
    18  	strconv.ParseInt("", 2, 0)
    19  	strconv.ParseInt("", 10, 0)
    20  	strconv.ParseInt("", 36, 0)
    21  	strconv.ParseInt("", 37, 0) //@ diag(`'base' must not be larger than 36`)
    22  
    23  	strconv.ParseUint("", 0, -1) //@ diag(`'bitSize' argument is invalid, must be within 0 and 64`)
    24  	strconv.ParseUint("", 0, 0)
    25  	strconv.ParseUint("", 0, 1)
    26  	strconv.ParseUint("", 0, 64)
    27  	strconv.ParseUint("", 0, 65) //@ diag(`'bitSize' argument is invalid, must be within 0 and 64`)
    28  	strconv.ParseUint("", -1, 0) //@ diag(`'base' must not be smaller than 2, unless it is 0`)
    29  	strconv.ParseUint("", 1, 0)  //@ diag(`'base' must not be smaller than 2, unless it is 0`)
    30  	strconv.ParseUint("", 2, 0)
    31  	strconv.ParseUint("", 10, 0)
    32  	strconv.ParseUint("", 36, 0)
    33  	strconv.ParseUint("", 37, 0) //@ diag(`'base' must not be larger than 36`)
    34  
    35  	strconv.FormatFloat(0, 'e', 0, 18) //@ diag(`'bitSize' argument is invalid, must be either 32 or 64`)
    36  	strconv.FormatFloat(0, 'e', 0, 32)
    37  	strconv.FormatFloat(0, 'e', 0, 64)
    38  	strconv.FormatFloat(0, 'e', 0, 128) //@ diag(`'bitSize' argument is invalid, must be either 32 or 64`)
    39  	strconv.FormatFloat(0, 'j', 0, 32)  //@ diag(`'fmt' argument is invalid: unknown format 'j'`)
    40  
    41  	strconv.FormatInt(0, 0) //@ diag(`'base' must not be smaller than 2`)
    42  	strconv.FormatInt(0, 1) //@ diag(`'base' must not be smaller than 2`)
    43  	strconv.FormatInt(0, 2)
    44  	strconv.FormatInt(0, 3)
    45  	strconv.FormatInt(0, 36)
    46  	strconv.FormatInt(0, 37) //@ diag(`'base' must not be larger than 36`)
    47  
    48  	strconv.FormatUint(0, 0) //@ diag(`'base' must not be smaller than 2`)
    49  	strconv.FormatUint(0, 1) //@ diag(`'base' must not be smaller than 2`)
    50  	strconv.FormatUint(0, 2)
    51  	strconv.FormatUint(0, 3)
    52  	strconv.FormatUint(0, 36)
    53  	strconv.FormatUint(0, 37) //@ diag(`'base' must not be larger than 36`)
    54  
    55  	strconv.AppendFloat(nil, 0, 'e', 0, 18) //@ diag(`'bitSize' argument is invalid, must be either 32 or 64`)
    56  	strconv.AppendFloat(nil, 0, 'e', 0, 32)
    57  	strconv.AppendFloat(nil, 0, 'e', 0, 64)
    58  	strconv.AppendFloat(nil, 0, 'e', 0, 128) //@ diag(`'bitSize' argument is invalid, must be either 32 or 64`)
    59  	strconv.AppendFloat(nil, 0, 'j', 0, 32)  //@ diag(`'fmt' argument is invalid: unknown format 'j'`)
    60  
    61  	strconv.AppendInt(nil, 0, 0) //@ diag(`'base' must not be smaller than 2`)
    62  	strconv.AppendInt(nil, 0, 1) //@ diag(`'base' must not be smaller than 2`)
    63  	strconv.AppendInt(nil, 0, 2)
    64  	strconv.AppendInt(nil, 0, 3)
    65  	strconv.AppendInt(nil, 0, 36)
    66  	strconv.AppendInt(nil, 0, 37) //@ diag(`'base' must not be larger than 36`)
    67  
    68  	strconv.AppendUint(nil, 0, 0) //@ diag(`'base' must not be smaller than 2`)
    69  	strconv.AppendUint(nil, 0, 1) //@ diag(`'base' must not be smaller than 2`)
    70  	strconv.AppendUint(nil, 0, 2)
    71  	strconv.AppendUint(nil, 0, 3)
    72  	strconv.AppendUint(nil, 0, 36)
    73  	strconv.AppendUint(nil, 0, 37) //@ diag(`'base' must not be larger than 36`)
    74  }