Source file src/cmd/go/internal/modconv/tsv.go

     1  // Copyright 2018 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 modconv
     6  
     7  import (
     8  	"strings"
     9  
    10  	"golang.org/x/mod/modfile"
    11  	"golang.org/x/mod/module"
    12  )
    13  
    14  func ParseDependenciesTSV(file string, data []byte) (*modfile.File, error) {
    15  	mf := new(modfile.File)
    16  	for _, line := range strings.Split(string(data), "\n") {
    17  		f := strings.Split(line, "\t")
    18  		if len(f) >= 3 {
    19  			mf.Require = append(mf.Require, &modfile.Require{Mod: module.Version{Path: f[0], Version: f[2]}})
    20  		}
    21  	}
    22  	return mf, nil
    23  }
    24  

View as plain text