github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/go/build/constraint/vers.go (about)

     1  // Copyright 2023 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 constraint
     6  
     7  // GoVersionは与えられたビルド条件によって暗黙的に指定される最小のGoバージョンを返します。
     8  // 条件式にGoバージョンタグがない場合、GoVersionは空の文字列を返します。
     9  //
    10  // 例:
    11  //
    12  //	GoVersion(linux && go1.22) = "go1.22"
    13  //	GoVersion((linux && go1.22) || (windows && go1.20)) = "go1.20" => go1.20
    14  //	GoVersion(linux) = ""
    15  //	GoVersion(linux || (windows && go1.22)) = ""
    16  //	GoVersion(!go1.22) = ""
    17  //
    18  // GoVersionは、任意のタグまたは否定されたタグが独立してtrueである可能性があると仮定しています。
    19  // そのため、解析はSATソルバーなしで純粋に構造的に行われます。
    20  //「不可能」とされる部分式は結果に影響する可能性があるためです。
    21  //
    22  // 例:
    23  //
    24  //	GoVersion((linux && !linux && go1.20) || go1.21) = "go1.20"
    25  func GoVersion(x Expr) string