...

Source file src/cmd/vendor/golang.org/x/tools/go/analysis/passes/stringintconv/doc.go

Documentation: cmd/vendor/golang.org/x/tools/go/analysis/passes/stringintconv

     1  // Copyright 2023 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package stringintconv defines an Analyzer that flags type conversions
     6  // from integers to strings.
     7  //
     8  // # Analyzer stringintconv
     9  //
    10  // stringintconv: check for string(int) conversions
    11  //
    12  // This checker flags conversions of the form string(x) where x is an integer
    13  // (but not byte or rune) type. Such conversions are discouraged because they
    14  // return the UTF-8 representation of the Unicode code point x, and not a decimal
    15  // string representation of x as one might expect. Furthermore, if x denotes an
    16  // invalid code point, the conversion cannot be statically rejected.
    17  //
    18  // For conversions that intend on using the code point, consider replacing them
    19  // with string(rune(x)). Otherwise, strconv.Itoa and its equivalents return the
    20  // string representation of the value in the desired base.
    21  package stringintconv
    22  

View as plain text