github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/internal/objabi/path.go (about)

     1  // Copyright 2017 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 objabi
     6  
     7  // PathToPrefix converts raw string to the prefix that will be used in the
     8  // symbol table. All control characters, space, '%' and '"', as well as
     9  // non-7-bit clean bytes turn into %xx. The period needs escaping only in the
    10  // last segment of the path, and it makes for happier users if we escape that as
    11  // little as possible.
    12  func PathToPrefix(s string) string
    13  
    14  // PrefixToPath is the inverse of PathToPrefix, replacing escape sequences with
    15  // the original character.
    16  func PrefixToPath(s string) (string, error)