main
Raw Download raw file
 1//go:build linux && go1.20
 2
 3// Copyright (C) 2024 SUSE LLC. All rights reserved.
 4// Use of this source code is governed by a BSD-style
 5// license that can be found in the LICENSE file.
 6
 7package securejoin
 8
 9import (
10	"fmt"
11)
12
13// wrapBaseError is a helper that is equivalent to fmt.Errorf("%w: %w"), except
14// that on pre-1.20 Go versions only errors.Is() works properly (errors.Unwrap)
15// is only guaranteed to give you baseErr.
16func wrapBaseError(baseErr, extraErr error) error {
17	return fmt.Errorf("%w: %w", extraErr, baseErr)
18}