Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for ReadComments (0.42 sec)

  1. src/cmd/go/internal/imports/read.go

    	c := r.peekByte(true)
    	if c == '.' {
    		r.peek = 0
    	} else if isIdent(c) {
    		r.readIdent()
    	}
    	r.readString(imports)
    }
    
    // ReadComments is like io.ReadAll, except that it only reads the leading
    // block of comments in the file.
    func ReadComments(f io.Reader) ([]byte, error) {
    	r := newImportReader(bufio.NewReader(f))
    	r.peekByte(true)
    	if r.err == nil && !r.eof {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 15 18:42:11 UTC 2021
    - 6.1K bytes
    - Viewed (0)
  2. src/cmd/dist/imports.go

    	c := r.peekByte(true)
    	if c == '.' {
    		r.peek = 0
    	} else if isIdent(c) {
    		r.readIdent()
    	}
    	r.readString(imports)
    }
    
    // readComments is like ioutil.ReadAll, except that it only reads the leading
    // block of comments in the file.
    func readComments(f io.Reader) ([]byte, error) {
    	r := &importReader{b: bufio.NewReader(f)}
    	r.peekByte(true)
    	if r.err == nil && !r.eof {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 28 21:45:30 UTC 2019
    - 6.3K bytes
    - Viewed (0)
  3. src/go/build/read.go

    	c := r.peekByte(true)
    	if c == '.' {
    		r.peek = 0
    	} else if isIdent(c) {
    		r.readIdent()
    	}
    	r.readString()
    }
    
    // readComments is like io.ReadAll, except that it only reads the leading
    // block of comments in the file.
    //
    // readComments should be an internal detail,
    // but widely used packages access it using linkname.
    // Notable members of the hall of shame include:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 16:25:21 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  4. src/cmd/go/internal/imports/read_test.go

    func TestReadImports(t *testing.T) {
    	testRead(t, readImportsTests, func(r io.Reader) ([]byte, error) { return ReadImports(r, true, nil) })
    }
    
    func TestReadComments(t *testing.T) {
    	testRead(t, readCommentsTests, ReadComments)
    }
    
    var readFailuresTests = []readTest{
    	{
    		`package`,
    		"syntax error",
    	},
    	{
    		"package p\n\x00\nimport `math`\n",
    		"unexpected NUL in input",
    	},
    	{
    		`package p; import`,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 15 18:42:11 UTC 2021
    - 4.2K bytes
    - Viewed (0)
  5. src/cmd/go/internal/modindex/build_read.go

    	c := r.peekByte(true)
    	if c == '.' {
    		r.peek = 0
    	} else if isIdent(c) {
    		r.readIdent()
    	}
    	r.readString()
    }
    
    // readComments is like io.ReadAll, except that it only reads the leading
    // block of comments in the file.
    func readComments(f io.Reader) ([]byte, error) {
    	r := newImportReader("", f)
    	r.peekByte(true)
    	if r.err == nil && !r.eof {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 23 10:10:21 UTC 2023
    - 13K bytes
    - Viewed (0)
  6. src/go/build/read_test.go

    		var info fileInfo
    		err := readGoInfo(r, &info)
    		return info.header, err
    	})
    }
    
    func TestReadComments(t *testing.T) {
    	testRead(t, readCommentsTests, readComments)
    }
    
    var readFailuresTests = []readTest{
    	{
    		`package`,
    		"syntax error",
    	},
    	{
    		"package p\n\x00\nimport `math`\n",
    		"unexpected NUL in input",
    	},
    	{
    		`package p; import`,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 06 15:53:04 UTC 2021
    - 6K bytes
    - Viewed (0)
  7. src/cmd/go/internal/modindex/build.go

    		err = readGoInfo(f, info)
    		if strings.HasSuffix(name, "_test.go") {
    			ignoreBinaryOnly = true // ignore //go:binary-only-package comments in _test.go files
    		}
    	} else {
    		info.header, err = readComments(f)
    	}
    	f.Close()
    	if err != nil {
    		return nil, fmt.Errorf("read %s: %v", info.name, err)
    	}
    
    	// Look for +build comments to accept or reject the file.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Aug 25 17:39:23 UTC 2023
    - 26.8K bytes
    - Viewed (0)
  8. src/go/build/build.go

    			binaryOnly = nil // ignore //go:binary-only-package comments in _test.go files
    		}
    	} else {
    		binaryOnly = nil // ignore //go:binary-only-package comments in non-Go sources
    		info.header, err = readComments(f)
    	}
    	f.Close()
    	if err != nil {
    		return info, fmt.Errorf("read %s: %v", info.name, err)
    	}
    
    	// Look for go:build comments to accept or reject the file.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 16:25:21 UTC 2024
    - 62.3K bytes
    - Viewed (0)
Back to top