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

Commit 9e5276e

Browse files
committed
Upgrade go-paths / remove duplicate filter function
1 parent cdd7b75 commit 9e5276e

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

‎.licenses/go/github.com/arduino/go-paths-helper.dep.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: github.com/arduino/go-paths-helper
3-
version: v1.10.1
3+
version: v1.11.0
44
type: go
55
summary:
66
homepage: https://pkg.go.dev/github.com/arduino/go-paths-helper

‎go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ replace github.com/mailru/easyjson => github.com/cmaglie/easyjson v0.8.1
77

88
require (
99
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371
10-
github.com/arduino/go-paths-helper v1.10.1
10+
github.com/arduino/go-paths-helper v1.11.0
1111
github.com/arduino/go-properties-orderedmap v1.8.0
1212
github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b
1313
github.com/arduino/go-win32-utils v1.0.0

‎go.sum‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ
1111
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
1212
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
1313
github.com/arduino/go-paths-helper v1.0.1/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
14-
github.com/arduino/go-paths-helper v1.10.1 h1:j8InnhLrSeoPiOvTnZL0XMFt7l407ciTBJJJs7W9bs4=
15-
github.com/arduino/go-paths-helper v1.10.1/go.mod h1:jcpW4wr0u69GlXhTYydsdsqAjLaYK5n7oWHfKqOG6LM=
14+
github.com/arduino/go-paths-helper v1.11.0 h1:hkpGb9AtCTByTj2FKutuHWb3klDf4kAKL10hW+fN+oE=
15+
github.com/arduino/go-paths-helper v1.11.0/go.mod h1:jcpW4wr0u69GlXhTYydsdsqAjLaYK5n7oWHfKqOG6LM=
1616
github.com/arduino/go-properties-orderedmap v1.8.0 h1:wEfa6hHdpezrVOh787OmClsf/Kd8qB+zE3P2Xbrn0CQ=
1717
github.com/arduino/go-properties-orderedmap v1.8.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk=
1818
github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b h1:9hDi4F2st6dbLC3y4i02zFT5quS4X6iioWifGlVwfy4=

‎internal/arduino/builder/linker.go‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@ import (
2222
"github.com/arduino/go-paths-helper"
2323
)
2424

25-
func filter(p *paths.PathList, filter func(*paths.Path) bool) paths.PathList {
26-
res := (*p)[:0]
27-
for _, path := range *p {
28-
if filter(path) {
29-
res = append(res, path)
30-
}
31-
}
32-
return res
33-
}
34-
3525
// link fixdoc
3626
func (b *Builder) link() error {
3727
if b.onlyUpdateCompilationDatabase {
@@ -64,14 +54,19 @@ func (b *Builder) link() error {
6454
// because thery are both named spi.o.
6555

6656
archives := paths.NewPathList()
67-
6857
for _, object := range objectFiles {
6958
archive := object.Parent().Join("objs.a")
7059
archives.AddIfMissing(archive)
7160
}
7261

62+
// Generate archive for each directory
7363
for _, archive := range archives {
74-
relatedObjectFiles := filter(&objectFiles, func(object *paths.Path) bool { return object.Parent().EquivalentTo(archive.Parent()) })
64+
archiveDir := archive.Parent()
65+
relatedObjectFiles := objectFiles.Clone()
66+
relatedObjectFiles.Filter(func(object *paths.Path) bool {
67+
// extract all the object files that are in the same directory of the archive
68+
return object.Parent().EquivalentTo(archiveDir)
69+
})
7570
b.archiveCompiledFiles(archive.Parent(), paths.New(archive.Base()), relatedObjectFiles)
7671
}
7772

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /