File tree 1 file changed +17
-4
lines changed 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -177,22 +177,35 @@ Files:
177
177
if arch == "" {
178
178
// Determine architecture from +build line if possible.
179
179
if m := asmPlusBuild .FindStringSubmatch (line ); m != nil {
180
- Fields:
180
+ // There can be multiple architectures in a single +build line,
181
+ // so accumulate them all and then prefer the one that
182
+ // matches build.Default.GOARCH.
183
+ var archCandidates []* asmArch
181
184
for _ , fld := range strings .Fields (m [1 ]) {
182
185
for _ , a := range arches {
183
186
if a .name == fld {
184
- arch = a .name
185
- archDef = a
186
- break Fields
187
+ archCandidates = append (archCandidates , a )
187
188
}
188
189
}
189
190
}
191
+ for _ , a := range archCandidates {
192
+ if a .name == build .Default .GOARCH {
193
+ archCandidates = []* asmArch {a }
194
+ break
195
+ }
196
+ }
197
+ if len (archCandidates ) > 0 {
198
+ arch = archCandidates [0 ].name
199
+ archDef = archCandidates [0 ]
200
+ }
190
201
}
191
202
}
192
203
193
204
if m := asmTEXT .FindStringSubmatch (line ); m != nil {
194
205
flushRet ()
195
206
if arch == "" {
207
+ // Arch not specified by filename or build tags.
208
+ // Fall back to build.Default.GOARCH.
196
209
for _ , a := range arches {
197
210
if a .name == build .Default .GOARCH {
198
211
arch = a .name
You can’t perform that action at this time.
0 commit comments