github.com/blend/go-sdk@v1.20220411.3/sourceutil/parse_go_import_rewrite_rules.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package sourceutil
     9  
    10  import "strings"
    11  
    12  // ParseGoImportRewriteRules parses go import rewrite rules as strings.
    13  func ParseGoImportRewriteRules(rewriteRules []string) (output []GoImportVisitor) {
    14  	for _, rewriteRule := range rewriteRules {
    15  		pieces := strings.SplitN(rewriteRule, "=", 2)
    16  		output = append(output, GoImportRewritePrefix(pieces[0], pieces[1]))
    17  	}
    18  	return
    19  }