...

Text file src/cmd/go/testdata/script/list_replace_absolute_windows.txt

Documentation: cmd/go/testdata/script

     1# Test a replacement with an absolute path (so the path isn't
     2# cleaned by having filepath.Abs called on it). This checks
     3# whether the modindex logic cleans the modroot path before using
     4# it.
     5
     6[!GOOS:windows] skip
     7[short] skip
     8
     9go run print_go_mod.go # use this program to write a go.mod with an absolute path
    10cp stdout go.mod
    11
    12go list -modfile=go.mod all
    13-- print_go_mod.go --
    14//go:build ignore
    15package main
    16
    17import (
    18    "fmt"
    19    "os"
    20)
    21
    22func main() {
    23    work := os.Getenv("WORK")
    24fmt.Printf(`module example.com/mod
    25
    26require b.com v0.0.0
    27
    28replace b.com => %s\gopath\src/modb
    29`,  work)
    30}
    31-- a.go --
    32package a
    33
    34import _ "b.com/b"
    35-- modb/go.mod --
    36module b.com
    37-- modb/b/b.go --
    38package b

View as plain text