Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for AddGoStmt (0.11 sec)

  1. src/cmd/go/internal/workcmd/init.go

    		base.Fatalf("go: %s already exists", gowork)
    	}
    
    	goV := gover.Local() // Use current Go version by default
    	wf := new(modfile.WorkFile)
    	wf.Syntax = new(modfile.FileSyntax)
    	wf.AddGoStmt(goV)
    	workUse(ctx, gowork, wf, args)
    	modload.WriteWorkFile(gowork, wf)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Jun 03 21:13:11 UTC 2023
    - 1.6K bytes
    - Viewed (0)
  2. src/cmd/vendor/golang.org/x/mod/modfile/work.go

    	w = 0
    	for _, r := range f.Replace {
    		if r.Old.Path != "" {
    			f.Replace[w] = r
    			w++
    		}
    	}
    	f.Replace = f.Replace[:w]
    
    	f.Syntax.Cleanup()
    }
    
    func (f *WorkFile) AddGoStmt(version string) error {
    	if !GoVersionRE.MatchString(version) {
    		return fmt.Errorf("invalid language version %q", version)
    	}
    	if f.Go == nil {
    		stmt := &Line{Token: []string{"go", version}}
    		f.Go = &Go{
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 14 18:34:56 UTC 2024
    - 7.7K bytes
    - Viewed (0)
  3. src/cmd/go/internal/modload/init.go

    }
    
    func mustHaveCompleteRequirements() bool {
    	return cfg.BuildMod != "mod" && !inWorkspaceMode()
    }
    
    // addGoStmt adds a go directive to the go.mod file if it does not already
    // include one. The 'go' version added, if any, is the latest version supported
    // by this toolchain.
    func addGoStmt(modFile *modfile.File, mod module.Version, v string) {
    	if modFile.Go != nil && modFile.Go.Version != "" {
    		return
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 06 18:36:30 UTC 2024
    - 69.8K bytes
    - Viewed (0)
  4. src/cmd/go/internal/workcmd/edit.go

    	if err != nil {
    		base.Fatalf("go: errors parsing %s:\n%s", base.ShortPath(gowork), err)
    	}
    
    	if *editGo == "none" {
    		workFile.DropGoStmt()
    	} else if *editGo != "" {
    		if err := workFile.AddGoStmt(*editGo); err != nil {
    			base.Fatalf("go: internal error: %v", err)
    		}
    	}
    	if *editToolchain == "none" {
    		workFile.DropToolchainStmt()
    	} else if *editToolchain != "" {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 13:52:10 UTC 2024
    - 11K bytes
    - Viewed (0)
  5. src/cmd/go/internal/modcmd/edit.go

    	}
    
    	if *editModule != "" {
    		modFile.AddModuleStmt(*editModule)
    	}
    
    	if *editGo == "none" {
    		modFile.DropGoStmt()
    	} else if *editGo != "" {
    		if err := modFile.AddGoStmt(*editGo); err != nil {
    			base.Fatalf("go: internal error: %v", err)
    		}
    	}
    	if *editToolchain == "none" {
    		modFile.DropToolchainStmt()
    	} else if *editToolchain != "" {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 13:52:10 UTC 2024
    - 17.2K bytes
    - Viewed (0)
  6. src/cmd/vendor/golang.org/x/mod/modfile/rule.go

    	w = 0
    	for _, r := range f.Retract {
    		if r.Low != "" || r.High != "" {
    			f.Retract[w] = r
    			w++
    		}
    	}
    	f.Retract = f.Retract[:w]
    
    	f.Syntax.Cleanup()
    }
    
    func (f *File) AddGoStmt(version string) error {
    	if !GoVersionRE.MatchString(version) {
    		return fmt.Errorf("invalid language version %q", version)
    	}
    	if f.Go == nil {
    		var hint Expr
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 14 18:34:56 UTC 2024
    - 46.5K bytes
    - Viewed (0)
Back to top