Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for initRewrite (0.17 sec)

  1. src/cmd/gofmt/gofmt_unix_test.go

    		t.Fatal(err)
    	}
    
    	info, err := os.Stat(fn)
    	if err != nil {
    		t.Fatal(err)
    	}
    
    	defer func() { *write = false }()
    	*write = true
    
    	initParserMode()
    	initRewrite()
    
    	const maxWeight = 2 << 20
    	var buf, errBuf strings.Builder
    	s := newSequencer(maxWeight, &buf, &errBuf)
    	s.Add(fileWeight(fn, info), func(r *reporter) error {
    		return processFile(fn, info, nil, r)
    	})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 18 12:52:14 UTC 2023
    - 1.4K bytes
    - Viewed (0)
  2. src/cmd/gofmt/gofmt_test.go

    		case "-s":
    			*simplifyAST = true
    		case "-stdin":
    			// fake flag - pretend input is from stdin
    			info = nil
    		default:
    			t.Errorf("unrecognized flag name: %s", name)
    		}
    	}
    
    	initParserMode()
    	initRewrite()
    
    	const maxWeight = 2 << 20
    	var buf, errBuf bytes.Buffer
    	s := newSequencer(maxWeight, &buf, &errBuf)
    	s.Add(fileWeight(in, info), func(r *reporter) error {
    		return processFile(in, info, nil, r)
    	})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 10 19:22:49 UTC 2022
    - 4.3K bytes
    - Viewed (0)
  3. src/cmd/gofmt/rewrite.go

    // license that can be found in the LICENSE file.
    
    package main
    
    import (
    	"fmt"
    	"go/ast"
    	"go/parser"
    	"go/token"
    	"os"
    	"reflect"
    	"strings"
    	"unicode"
    	"unicode/utf8"
    )
    
    func initRewrite() {
    	if *rewriteRule == "" {
    		rewrite = nil // disable any previous rewrite
    		return
    	}
    	f := strings.Split(*rewriteRule, "->")
    	if len(f) != 2 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jul 27 22:07:13 UTC 2023
    - 8.1K bytes
    - Viewed (0)
  4. src/cmd/gofmt/gofmt.go

    			return
    		}
    		defer func() {
    			f.Close()
    			<-fdSem
    		}()
    		pprof.StartCPUProfile(f)
    		defer pprof.StopCPUProfile()
    	}
    
    	initParserMode()
    	initRewrite()
    
    	args := flag.Args()
    	if len(args) == 0 {
    		if *write {
    			s.AddReport(fmt.Errorf("error: cannot use -w with standard input"))
    			return
    		}
    		s.Add(0, func(r *reporter) error {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 14 19:41:17 UTC 2024
    - 15.1K bytes
    - Viewed (0)
Back to top