...

Source file src/github.com/rogpeppe/go-internal/goproxytest/pseudo.go

Documentation: github.com/rogpeppe/go-internal/goproxytest

     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 goproxytest
     6  
     7  import (
     8  	"regexp"
     9  	"strings"
    10  
    11  	"golang.org/x/mod/semver"
    12  )
    13  
    14  // This code was taken from cmd/go/internal/modfetch/pseudo.go
    15  
    16  var pseudoVersionRE = regexp.MustCompile(`^v[0-9]+\.(0\.0-|\d+\.\d+-([^+]*\.)?0\.)\d{14}-[A-Za-z0-9]+(\+incompatible)?$`)
    17  
    18  // isPseudoVersion reports whether v is a pseudo-version.
    19  func isPseudoVersion(v string) bool {
    20  	return strings.Count(v, "-") >= 2 && semver.IsValid(v) && pseudoVersionRE.MatchString(v)
    21  }
    22  

View as plain text