@@ -18,7 +18,6 @@ import (
18
18
"io/ioutil"
19
19
"log"
20
20
"os"
21
- "os/user"
22
21
"path/filepath"
23
22
"strconv"
24
23
"strings"
@@ -30,11 +29,7 @@ import (
30
29
"golang.org/x/tools/go/packages"
31
30
)
32
31
33
- var (
34
- versionFlag = flag .String ("version" , "" , "version to tag" )
35
- remoteFlag = flag .String ("remote" , "" , "remote to which to push the tag" )
36
- releaseFlag = flag .Bool ("release" , false , "release is true if you intend to tag and push a release" )
37
- )
32
+ var versionFlag = flag .String ("version" , "" , "version to tag" )
38
33
39
34
func main () {
40
35
flag .Parse ()
@@ -51,13 +46,6 @@ func main() {
51
46
if semver .Build (* versionFlag ) != "" {
52
47
log .Fatalf ("unexpected build suffix: %s" , * versionFlag )
53
48
}
54
- if * releaseFlag && * remoteFlag == "" {
55
- log .Fatalf ("must provide -remote flag if releasing" )
56
- }
57
- user , err := user .Current ()
58
- if err != nil {
59
- log .Fatal (err )
60
- }
61
49
// Validate that the user is running the program from the gopls module.
62
50
wd , err := os .Getwd ()
63
51
if err != nil {
@@ -66,11 +54,6 @@ func main() {
66
54
if filepath .Base (wd ) != "gopls" {
67
55
log .Fatalf ("must run from the gopls module" )
68
56
}
69
- // Confirm that they are running on a branch with a name following the
70
- // format of "gopls-release-branch.<major>.<minor>".
71
- if err := validateBranchName (* versionFlag ); err != nil {
72
- log .Fatal (err )
73
- }
74
57
// Confirm that they have updated the hardcoded version.
75
58
if err := validateHardcodedVersion (* versionFlag ); err != nil {
76
59
log .Fatal (err )
@@ -79,52 +62,8 @@ func main() {
79
62
if err := validateGoModFile (wd ); err != nil {
80
63
log .Fatal (err )
81
64
}
82
- earlyExitMsg := "Validated that the release is ready. Exiting without tagging and publishing."
83
- if ! * releaseFlag {
84
- fmt .Println (earlyExitMsg )
85
- os .Exit (0 )
86
- }
87
- fmt .Println (`Proceeding to tagging and publishing the release...
88
- Please enter Y if you wish to proceed or anything else if you wish to exit.` )
89
- // Accept and process user input.
90
- var input string
91
- fmt .Scanln (& input )
92
- switch input {
93
- case "Y" :
94
- fmt .Println ("Proceeding to tagging and publishing the release." )
95
- default :
96
- fmt .Println (earlyExitMsg )
97
- os .Exit (0 )
98
- }
99
- // To tag the release:
100
- // $ git -c [email protected] tag -a -m “<message>” gopls/v<major>.<minor>.<patch>-<pre-release>
101
- goplsVersion := fmt .Sprintf ("gopls/%s" , * versionFlag )
102
- cmd := exec .
Command (
"git" ,
"-c" ,
fmt .
Sprintf (
"user.email=%[email protected] " ,
user .
Username ),
"tag" ,
"-a" ,
"-m" ,
fmt .
Sprintf (
"%q" ,
goplsVersion ),
goplsVersion )
103
- if err := cmd .Run (); err != nil {
104
- log .Fatal (err )
105
- }
106
- // Push the tag to the remote:
107
- // $ git push <remote> gopls/v<major>.<minor>.<patch>-pre.1
108
- cmd = exec .Command ("git" , "push" , * remoteFlag , goplsVersion )
109
- if err := cmd .Run (); err != nil {
110
- log .Fatal (err )
111
- }
112
- }
113
-
114
- // validateBranchName reports whether the user's current branch name is of the
115
- // form "gopls-release-branch.<major>.<minor>". It reports an error if not.
116
- func validateBranchName (version string ) error {
117
- cmd := exec .Command ("git" , "branch" , "--show-current" )
118
- stdout , err := cmd .Output ()
119
- if err != nil {
120
- return err
121
- }
122
- branch := strings .TrimSpace (string (stdout ))
123
- expectedBranch := fmt .Sprintf ("gopls-release-branch.%s" , strings .TrimPrefix (semver .MajorMinor (version ), "v" ))
124
- if branch != expectedBranch {
125
- return fmt .Errorf ("expected release branch %s, got %s" , expectedBranch , branch )
126
- }
127
- return nil
65
+ fmt .Println ("Validated that the release is ready." )
66
+ os .Exit (0 )
128
67
}
129
68
130
69
// validateHardcodedVersion reports whether the version hardcoded in the gopls
0 commit comments