Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit30def9c

Browse files
committed
x/tools: remove unused parameters
(As found by gopls/internal/analysis/unusedparam.)Change-Id: I8301f06964bc8462047dd4c3a946aa08475daf0cReviewed-on:https://go-review.googlesource.com/c/tools/+/718500Reviewed-by: Robert Findley <rfindley@google.com>LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent277e1b1 commit30def9c

File tree

14 files changed

+50
-51
lines changed

14 files changed

+50
-51
lines changed

‎cmd/gonew/main.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func main() {
150150
data=fixGo(data,rel,srcMod,dstMod,isRoot)
151151
}
152152
ifrel=="go.mod" {
153-
data=fixGoMod(data,srcMod,dstMod)
153+
data=fixGoMod(data,dstMod)
154154
}
155155

156156
iferr:=os.WriteFile(dst,data,0666);err!=nil {
@@ -217,9 +217,9 @@ func fixGo(data []byte, file string, srcMod, dstMod string, isRoot bool) []byte
217217
returnbuf.Bytes()
218218
}
219219

220-
// fixGoMod rewrites the go.mod content in data toreplace srcMod with dstMod
221-
//in the module path.
222-
funcfixGoMod(data []byte,srcMod,dstModstring) []byte {
220+
// fixGoMod rewrites the go.mod content in data toadd a module
221+
//statement for dstMod.
222+
funcfixGoMod(data []byte,dstModstring) []byte {
223223
f,err:=modfile.ParseLax("go.mod",data,nil)
224224
iferr!=nil {
225225
log.Fatalf("parsing source module:\n%s",err)

‎cmd/present2md/main.go‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ func convert(r io.Reader, file string, writeBack bool) error {
126126
continue
127127
}
128128
fmt.Fprintf(&md,"Summary:")
129-
fori,line:=rangetext.Lines {
129+
for_,line:=rangetext.Lines {
130130
fmt.Fprintf(&md," ")
131-
printStyled(&md,line,i==0)
131+
printStyled(&md,line)
132132
}
133133
fmt.Fprintf(&md,"\n")
134134
break
@@ -145,10 +145,10 @@ func convert(r io.Reader, file string, writeBack bool) error {
145145
log.Fatalf("%s: unexpected author type %T",file,elem)
146146
case present.Text:
147147
for_,line:=rangeelem.Lines {
148-
fmt.Fprintf(&md,"%s\n",markdownEscape(line,true))
148+
fmt.Fprintf(&md,"%s\n",markdownEscape(line))
149149
}
150150
case present.Link:
151-
fmt.Fprintf(&md,"%s\n",markdownEscape(elem.Label,true))
151+
fmt.Fprintf(&md,"%s\n",markdownEscape(elem.Label))
152152
}
153153
}
154154
}
@@ -174,7 +174,7 @@ func convert(r io.Reader, file string, writeBack bool) error {
174174
}else {
175175
for_,s:=rangedoc.Sections {
176176
fmt.Fprintf(&md,"\n")
177-
fmt.Fprintf(&md,"## %s\n",markdownEscape(s.Title,false))
177+
fmt.Fprintf(&md,"## %s\n",markdownEscape(s.Title))
178178
printSectionBody(file,1,&md,s.Elem)
179179
}
180180
}
@@ -209,7 +209,7 @@ func printSectionBody(file string, depth int, w *bytes.Buffer, elems []present.E
209209
}
210210
}else {
211211
for_,line:=rangeelem.Lines {
212-
printStyled(w,line,true)
212+
printStyled(w,line)
213213
fmt.Fprintf(w,"\n")
214214
}
215215
}
@@ -222,7 +222,7 @@ func printSectionBody(file string, depth int, w *bytes.Buffer, elems []present.E
222222
ifi>0 {
223223
fmt.Fprintf(w," ")
224224
}
225-
printStyled(w,line,false)
225+
printStyled(w,line)
226226
fmt.Fprintf(w,"\n")
227227
}
228228
}
@@ -233,7 +233,7 @@ func printSectionBody(file string, depth int, w *bytes.Buffer, elems []present.E
233233
ifelem.Title=="" {
234234
sep=""
235235
}
236-
fmt.Fprintf(w,"%s%s%s\n",strings.Repeat("#",depth+2),sep,markdownEscape(elem.Title,false))
236+
fmt.Fprintf(w,"%s%s%s\n",strings.Repeat("#",depth+2),sep,markdownEscape(elem.Title))
237237
printSectionBody(file,depth+1,w,elem.Elem)
238238

239239
caseinterface{PresentCmd()string }:
@@ -251,7 +251,7 @@ func printSectionBody(file string, depth int, w *bytes.Buffer, elems []present.E
251251
}
252252
}
253253

254-
funcmarkdownEscape(sstring,startLinebool)string {
254+
funcmarkdownEscape(sstring)string {
255255
varb strings.Builder
256256
fori,r:=ranges {
257257
switch {
@@ -282,20 +282,20 @@ func markdownEscape(s string, startLine bool) string {
282282
<i>this is italic</i>!
283283
*/
284284

285-
funcprintStyled(w*bytes.Buffer,textstring,startLinebool) {
286-
w.WriteString(font(text,startLine))
285+
funcprintStyled(w*bytes.Buffer,textstring) {
286+
w.WriteString(font(text))
287287
}
288288

289289
// font returns s with font indicators turned into HTML font tags.
290-
funcfont(sstring,startLinebool)string {
290+
funcfont(sstring)string {
291291
if!strings.ContainsAny(s,"[`_*") {
292-
returnmarkdownEscape(s,startLine)
292+
returnmarkdownEscape(s)
293293
}
294294
words:=split(s)
295295
varb bytes.Buffer
296296
Word:
297297
forw,word:=rangewords {
298-
words[w]=markdownEscape(word,startLine&&w==0)// for all the continue Word
298+
words[w]=markdownEscape(word)// for all the continue Word
299299
iflen(word)<2 {
300300
continue Word
301301
}
@@ -316,7 +316,7 @@ Word:
316316
continue Word
317317
}
318318
}
319-
open,word:=markdownEscape(word[:first],startLine&&w==0),word[first:]
319+
open,word:=markdownEscape(word[:first]),word[first:]
320320
char:=word[0]// ASCII is OK.
321321
close:=""
322322
switchchar {
@@ -371,7 +371,7 @@ Word:
371371
close+="`"
372372
}
373373
}else {
374-
text=markdownEscape(text,false)
374+
text=markdownEscape(text)
375375
}
376376
words[w]=open+text+close+tail
377377
}
@@ -463,9 +463,9 @@ func parseInlineLink(s string) (link string, length int) {
463463
}
464464

465465
funcrenderLink(href,textstring)string {
466-
text=font(text,false)
466+
text=font(text)
467467
iftext=="" {
468-
text=markdownEscape(href,false)
468+
text=markdownEscape(href)
469469
}
470470
return"["+text+"]("+href+")"
471471
}

‎go/analysis/passes/stdmethods/stdmethods.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ func canonicalMethod(pass *analysis.Pass, id *ast.Ident) {
131131
}
132132

133133
// Do the =s (if any) all match?
134-
if!matchParams(pass,expect.args,args,"=")||!matchParams(pass,expect.results,results,"=") {
134+
if!matchParams(expect.args,args,"=")||!matchParams(expect.results,results,"=") {
135135
return
136136
}
137137

138138
// Everything must match.
139-
if!matchParams(pass,expect.args,args,"")||!matchParams(pass,expect.results,results,"") {
139+
if!matchParams(expect.args,args,"")||!matchParams(expect.results,results,"") {
140140
expectFmt:=id.Name+"("+argjoin(expect.args)+")"
141141
iflen(expect.results)==1 {
142142
expectFmt+=" "+argjoin(expect.results)
@@ -168,7 +168,7 @@ func argjoin(x []string) string {
168168
}
169169

170170
// Does each type in expect with the given prefix match the corresponding type in actual?
171-
funcmatchParams(pass*analysis.Pass,expect []string,actual*types.Tuple,prefixstring)bool {
171+
funcmatchParams(expect []string,actual*types.Tuple,prefixstring)bool {
172172
fori,x:=rangeexpect {
173173
if!strings.HasPrefix(x,prefix) {
174174
continue

‎go/ssa/builder.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2344,7 +2344,7 @@ func (b *builder) rangeStmt(fn *Function, s *ast.RangeStmt, label *lblock) {
23442344
// for x := range f { ... }
23452345
// into
23462346
// f(func(x T) bool { ... })
2347-
b.rangeFunc(fn,x,tk,tv,s,label)
2347+
b.rangeFunc(fn,x,s,label)
23482348
return
23492349

23502350
default:
@@ -2390,7 +2390,7 @@ func (b *builder) rangeStmt(fn *Function, s *ast.RangeStmt, label *lblock) {
23902390
// rangeFunc emits to fn code for the range-over-func rng.Body of the iterator
23912391
// function x, optionally labelled by label. It creates a new anonymous function
23922392
// yield for rng and builds the function.
2393-
func (b*builder)rangeFunc(fn*Function,xValue,tk,tv types.Type,rng*ast.RangeStmt,label*lblock) {
2393+
func (b*builder)rangeFunc(fn*Function,xValue,rng*ast.RangeStmt,label*lblock) {
23942394
// Consider the SSA code for the outermost range-over-func in fn:
23952395
//
23962396
// func fn(...) (ret R) {

‎go/ssa/instantiate.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func createInstance(fn *Function, targs []types.Type) *Function {
8383
ifprog.mode&InstantiateGenerics!=0&&!prog.isParameterized(targs...) {
8484
synthetic=fmt.Sprintf("instance of %s",fn.Name())
8585
iffn.syntax!=nil {
86-
subst=makeSubster(prog.ctxt,obj,fn.typeparams,targs,false)
86+
subst=makeSubster(prog.ctxt,obj,fn.typeparams,targs)
8787
build= (*builder).buildFromSyntax
8888
}else {
8989
build= (*builder).buildParamsOnly

‎go/ssa/interp/interp.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ func visitInstr(fr *frame, instr ssa.Instruction) continuation {
319319
fr.env[instr]=makeMap(instr.Type().Underlying().(*types.Map).Key(),reserve)
320320

321321
case*ssa.Range:
322-
fr.env[instr]=rangeIter(fr.get(instr.X),instr.X.Type())
322+
fr.env[instr]=rangeIter(fr.get(instr.X))
323323

324324
case*ssa.Next:
325325
fr.env[instr]=fr.get(instr.Iter).(iter).next()
@@ -372,7 +372,7 @@ func visitInstr(fr *frame, instr ssa.Instruction) continuation {
372372
}
373373

374374
case*ssa.TypeAssert:
375-
fr.env[instr]=typeAssert(fr.i,instr,fr.get(instr.X).(iface))
375+
fr.env[instr]=typeAssert(instr,fr.get(instr.X).(iface))
376376

377377
case*ssa.MakeClosure:
378378
varbindings []value
@@ -479,7 +479,7 @@ func call(i *interpreter, caller *frame, callpos token.Pos, fn value, args []val
479479
case*closure:
480480
returncallSSA(i,caller,callpos,fn.Fn,args,fn.Env)
481481
case*ssa.Builtin:
482-
returncallBuiltin(caller,callpos,fn,args)
482+
returncallBuiltin(caller,fn,args)
483483
}
484484
panic(fmt.Sprintf("cannot call %T",fn))
485485
}

‎go/ssa/interp/ops.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -918,15 +918,15 @@ func unop(instr *ssa.UnOp, x value) value {
918918
// typeAssert checks whether dynamic type of itf is instr.AssertedType.
919919
// It returns the extracted value on success, and panics on failure,
920920
// unless instr.CommaOk, in which case it always returns a "value,ok" tuple.
921-
functypeAssert(i*interpreter,instr*ssa.TypeAssert,itfiface)value {
921+
functypeAssert(instr*ssa.TypeAssert,itfiface)value {
922922
varvvalue
923923
err:=""
924924
ifitf.t==nil {
925925
err=fmt.Sprintf("interface conversion: interface is nil, not %s",instr.AssertedType)
926926

927927
}elseifidst,ok:=instr.AssertedType.Underlying().(*types.Interface);ok {
928928
v=itf
929-
err=checkInterface(i,idst,itf)
929+
err=checkInterface(idst,itf)
930930

931931
}elseiftypes.Identical(itf.t,instr.AssertedType) {
932932
v=itf.v// extract value
@@ -954,7 +954,7 @@ var CapturedOutput *bytes.Buffer
954954

955955
// callBuiltin interprets a call to builtin fn with arguments args,
956956
// returning its result.
957-
funccallBuiltin(caller*frame,callpos token.Pos,fn*ssa.Builtin,args []value)value {
957+
funccallBuiltin(caller*frame,fn*ssa.Builtin,args []value)value {
958958
switchfn.Name() {
959959
case"append":
960960
iflen(args)==1 {
@@ -1103,7 +1103,7 @@ func callBuiltin(caller *frame, callpos token.Pos, fn *ssa.Builtin, args []value
11031103
panic("unknown built-in: "+fn.Name())
11041104
}
11051105

1106-
funcrangeIter(xvalue,t types.Type)iter {
1106+
funcrangeIter(xvalue)iter {
11071107
switchx:=x.(type) {
11081108
casemap[value]value:
11091109
return&mapIter{iter:reflect.ValueOf(x).MapRange()}
@@ -1407,7 +1407,7 @@ func sliceToArrayPointer(t_dst, t_src types.Type, x value) value {
14071407
// checkInterface checks that the method set of x implements the
14081408
// interface itype.
14091409
// On success it returns "", on failure, an error message.
1410-
funccheckInterface(i*interpreter,itype*types.Interface,xiface)string {
1410+
funccheckInterface(itype*types.Interface,xiface)string {
14111411
ifmeth,_:=types.MissingMethod(x.t,itype,true);meth!=nil {
14121412
returnfmt.Sprintf("interface conversion: %v is not %v: missing method %s",
14131413
x.t,itype,meth.Name())

‎go/ssa/interp/reflect.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ func ext۰reflect۰Value۰Float(fr *frame, args []value) value {
437437

438438
funcext۰reflect۰Value۰Interface(fr*frame,args []value)value {
439439
// Signature: func (v reflect.Value) interface{}
440-
returnext۰reflect۰valueInterface(fr,args)
440+
returnext۰reflect۰valueInterface(args)
441441
}
442442

443443
funcext۰reflect۰Value۰Int(fr*frame,args []value)value {
@@ -494,7 +494,7 @@ func ext۰reflect۰Value۰Set(fr *frame, args []value) value {
494494
returnnil
495495
}
496496

497-
funcext۰reflect۰valueInterface(fr*frame,args []value)value {
497+
funcext۰reflect۰valueInterface(args []value)value {
498498
// Signature: func (v reflect.Value, safe bool) interface{}
499499
v:=args[0].(structure)
500500
returniface{rV2T(v).t,rV2V(v)}

‎go/ssa/subst.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ type subster struct {
5959
// Returns a subster that replaces tparams[i] with targs[i]. Uses ctxt as a cache.
6060
// targs should not contain any types in tparams.
6161
// fn is the generic function for which we are substituting.
62-
funcmakeSubster(ctxt*types.Context,fn*types.Func,tparams*types.TypeParamList,targs []types.Type,debugbool)*subster {
62+
funcmakeSubster(ctxt*types.Context,fn*types.Func,tparams*types.TypeParamList,targs []types.Type)*subster {
6363
assert(tparams.Len()==len(targs),"makeSubster argument count must match")
6464

6565
subst:=&subster{

‎go/ssa/subst_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ var _ L[int] = Fn0[L[int]](nil)
103103

104104
T:=tv.Type.(*types.Named)
105105

106-
subst:=makeSubster(types.NewContext(),within,T.TypeParams(),targs,true)
106+
subst:=makeSubster(types.NewContext(),within,T.TypeParams(),targs)
107107
sub:=subst.typ(T.Underlying())
108108
ifgot:=sub.String();got!=test.want {
109109
t.Errorf("subst{%v->%v}.typ(%s) = %v, want %v",test.expr,test.args,T.Underlying(),got,test.want)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp