mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
committed by
GitHub
parent
87260e4a60
commit
e31ff547d2
@@ -14,7 +14,6 @@
|
||||
package hugolib
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"context"
|
||||
"fmt"
|
||||
"path"
|
||||
@@ -23,6 +22,7 @@ import (
|
||||
|
||||
"github.com/bep/helpers/maphelpers"
|
||||
"github.com/gohugoio/go-radix"
|
||||
"github.com/gohugoio/hugo/common/herrors"
|
||||
"github.com/gohugoio/hugo/common/paths"
|
||||
"github.com/gohugoio/hugo/common/types"
|
||||
"github.com/gohugoio/hugo/hugofs/files"
|
||||
@@ -134,7 +134,7 @@ func (a *allPagesAssembler) createAllPages() error {
|
||||
}()
|
||||
}
|
||||
|
||||
if err := cmp.Or(a.doCreatePages("", 0), a.g.Wait()); err != nil {
|
||||
if err := herrors.Or(a.doCreatePages("", 0), a.g.Wait()); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := a.pwRoot.WalkContext.HandleEventsAndHooks(); err != nil {
|
||||
|
||||
@@ -1179,23 +1179,7 @@ func (s *IntegrationTestBuilder) readFileFromFs(t testing.TB, fs afero.Fs, filen
|
||||
t.Helper()
|
||||
filename = filepath.Clean(filename)
|
||||
b, err := afero.ReadFile(fs, filename)
|
||||
if err != nil {
|
||||
// Print some debug info
|
||||
hadSlash := strings.HasPrefix(filename, helpers.FilePathSeparator)
|
||||
start := 0
|
||||
if hadSlash {
|
||||
start = 1
|
||||
}
|
||||
end := start + 1
|
||||
|
||||
parts := strings.Split(filename, helpers.FilePathSeparator)
|
||||
if parts[start] == "work" {
|
||||
end++
|
||||
}
|
||||
|
||||
s.Assert(err, qt.IsNil)
|
||||
|
||||
}
|
||||
s.Assert(err, qt.IsNil)
|
||||
return string(b)
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
package sitesmatrix
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"fmt"
|
||||
"iter"
|
||||
"maps"
|
||||
@@ -780,7 +779,7 @@ func (b *IntSetsBuilder) Build() *IntSets {
|
||||
}
|
||||
|
||||
func (b *IntSetsBuilder) WithConfig(cfg IntSetsConfig) *IntSetsBuilder {
|
||||
applyFilter := func(what string, values []string, matcher ConfiguredDimension) (*hmaps.OrderedIntSet, error) {
|
||||
applyFilter := func(what string, values []string, matcher ConfiguredDimension) *hmaps.OrderedIntSet {
|
||||
var result *hmaps.OrderedIntSet
|
||||
if len(values) == 0 {
|
||||
|
||||
@@ -800,16 +799,16 @@ func (b *IntSetsBuilder) WithConfig(cfg IntSetsConfig) *IntSetsBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
return result
|
||||
}
|
||||
|
||||
filter, err := predicate.NewIndexStringPredicateFromGlobsAndRanges(values, matcher.ResolveIndex, hglob.GetGlobDot)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create filter for %s: %w", what, err)
|
||||
panic(fmt.Errorf("failed to create filter for %s: %w", what, err))
|
||||
}
|
||||
iter, err := matcher.IndexMatch(filter)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to match %s %q: %w", what, values, err)
|
||||
panic(fmt.Errorf("failed to match %s %q: %w", what, values, err))
|
||||
}
|
||||
for i := range iter {
|
||||
if result == nil {
|
||||
@@ -818,16 +817,12 @@ func (b *IntSetsBuilder) WithConfig(cfg IntSetsConfig) *IntSetsBuilder {
|
||||
result.Set(i)
|
||||
}
|
||||
|
||||
return result, nil
|
||||
return result
|
||||
}
|
||||
|
||||
l, err1 := applyFilter("languages", cfg.Globs.Languages, b.cfg.ConfiguredLanguages)
|
||||
v, err2 := applyFilter("versions", cfg.Globs.Versions, b.cfg.ConfiguredVersions)
|
||||
r, err3 := applyFilter("roles", cfg.Globs.Roles, b.cfg.ConfiguredRoles)
|
||||
|
||||
if err := cmp.Or(err1, err2, err3); err != nil {
|
||||
panic(fmt.Errorf("failed to apply filters: %w", err))
|
||||
}
|
||||
l := applyFilter("languages", cfg.Globs.Languages, b.cfg.ConfiguredLanguages)
|
||||
v := applyFilter("versions", cfg.Globs.Versions, b.cfg.ConfiguredVersions)
|
||||
r := applyFilter("roles", cfg.Globs.Roles, b.cfg.ConfiguredRoles)
|
||||
|
||||
b.GlobFilterMisses = Bools{
|
||||
len(cfg.Globs.Languages) > 0 && l == nil,
|
||||
|
||||
Reference in New Issue
Block a user