Commit Graph

32 Commits

Author SHA1 Message Date
Kir Kolyshkin a4d8f720a2 Format sources with gofumpt
gofumpt is a superset of gofmt, enabling some more code formatting
rules.

This commit is brought to you by

	gofumpt -w .

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2023-05-26 16:17:31 -07:00
Daniel J Walsh a3204cf7e8
Move to golang 1.18 and later
Github.com is reporting security issues on older versions of
golang.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-04-03 15:26:54 -04:00
Miloslav Trmač 5e410ef763 Misc individual warning fixes
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-10-14 17:17:53 +02:00
Sascha Grunert 3455d12729
Switch to golang native error wrapping
We now use the golang error wrapping format specifier `%w` instead of the
deprecated github.com/pkg/errors package.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-07-07 13:22:46 +02:00
Daniel J Walsh 94b63f024e
Cleanup exclude exceptions path
It is legal to use !./PATH and !/PATH in a .containerignore or
.dockerignore file.

Currently we fail to match on these patterns,  Removing the leadking
"/" and cleaning the path, fixes the problem.

Fixes: https://github.com/containers/buildah/issues/3272

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-07-07 06:50:25 -04:00
Daniel J Walsh e0baaad357
Fix problems found by codespell
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-11 10:49:59 -04:00
Nalin Dahyabhai 8b06777729 fileutils.Pattern.compile(): end the regex with the right path separator
When building the regex that matches patterns, the ending bit that
matches items below directories that match the pattern should be built
using the OS-specific path separator, which is not always '/'.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2020-08-10 22:22:00 -04:00
Yann Soubeyrand f832879256 Allow double star exclude patterns to match directories
Currently, double star exclude patterns are only able to match files. They
should also match directories.

Signed-off-by: Yann Soubeyrand <yann.soubeyrand@camptocamp.com>
2020-05-08 20:21:15 +02:00
Yann Soubeyrand 694c692ecf Error out when an exclude pattern ends with a single slash
Exclude patterns ending with a single slash are invalid and lead to a regexp
wrongly matching a dollar at the end of the file path. Error out instead of
building a bad regexp.

Signed-off-by: Yann Soubeyrand <yann.soubeyrand@camptocamp.com>
2020-05-08 20:04:14 +02:00
Valentin Rothberg 4d2b7f544b mount.Mounted: normalize mountpoints
Commit 90513cbb96 introduced a regression as specified mountpoints
must be normalized (e.g., "" -> "/") before we can deal with them.
Instead of working around the fileutils package and special casing
files, add a new `fileutils.ReadSymlinkedPath` which can work with
directories and files.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-03-17 12:24:10 +01:00
Sascha Grunert b66d5a5c12
Enable goconst linter and fix lints
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-01-28 15:59:15 +01:00
Sascha Grunert 5e07044cf0
Add indicator for last matched result
This information is needed as well if we want to match
in a way that the last match has the highest priority.

We now introduce a new method `MatchesResult` to not break the previous
API.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-11-16 09:09:26 -08:00
Sascha Grunert 7f9806911a
Add excluded information to matches
We now add the information how many exclusions a match has, which is
needed for more fine-granular filepath matching.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-10-17 16:13:04 +02:00
Sascha Grunert 42086a5010
Add pure file matches indicator
The `pure` indicator for a match now returns `true` if it's the only
one. This additional information will be used by consumers to decide
more fine-granular if a match can be excluded completely or not.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-10-16 13:58:47 +02:00
Daniel J Walsh f39066fe1b Update packages to match latest code in moby/pkg
Had to vendor in a new version of golang.org/x/net to build
Also had to make some changes to drivers to handle
archive.Reader -> io.Reader
archive.Archive -> io.ReadCloser

Also update .gitingore to ignore emacs files, containers-storage.*
and generated man pages.

Also no longer test travis against golang 1.7, cri-o, moby have also
done this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-12 18:00:29 +00:00
Mrunal Patel 59da502256 Update deps to github.com/sirupsen/logrus v1.0.0
Also updates github.com/Microsoft/hcsshim
and github.com/docker/go-connections so they work
with the newer version of logrus.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-08-01 07:25:56 -07:00
allencloud 3f77baf2ce fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-05-06 18:23:11 +08:00
John Howard b368a9f9b7 Windows CI: Fixes panic in test-unit for FileUtils
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-02-23 13:31:45 -08:00
Justas Brazauskas 927b334ebf Fix typos found across repository
Signed-off-by: Justas Brazauskas <brazauskasjustas@gmail.com>
2015-12-13 18:04:12 +02:00
Doug Davis eddb14a44e Support multi-dir wildcards in .dockerignore
Closes #13113

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-11-13 13:44:07 -08:00
John Howard 8d56108ffb Windows: Fix warning on info
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-09-18 13:39:12 -07:00
Vincent Demeester 09adf87f23 Add missing tests and docs for pkg/fileutils
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-07-12 22:43:42 +02:00
Lei Jitang 289ee90b04 Fix copy from a "created" container. Fixes #14420
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-07-08 11:15:09 +08:00
unclejack 2f6e4fdb29 linting changes
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2015-06-17 01:16:57 +03:00
Doug Davis 82ea6ed2bc Allow .dockerignore to ignore everything
Change CLI error msg because it was too specific and didn't make sense
when there were errors not related to inaccessible files.

Removed some log.Error() calls since they're not really errors we should
log. Returning the error will be enough.

Closes: #13417

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-05-30 04:16:00 -07:00
Vincent Demeester 8454e1a3b2 Add coverage on pkg/fileutils
Should fix #11598

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-04-29 16:27:12 +02:00
buddhamagnet 6fd8e485c8 add support for exclusion rules in dockerignore
Signed-off-by: Dave Goodchild <buddhamagnet@gmail.com>
2015-04-28 18:56:45 +01:00
Antonio Murdaca c30a55f14d Refactor utils/utils, fixes #11923
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-14 01:37:36 +02:00
Antonio Murdaca 01724c1cf1 Refactor ultis/utils_daemon, fixes #11908
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-03 20:20:04 +02:00
Antonio Murdaca 6f4d847046 Replace aliased imports of logrus, fixes #11762
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-26 23:22:04 +01:00
Alexandr Morozov 7c62cee51e Use logrus everywhere for logging
Fixed #8761

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:03:06 -07:00
Rafe Colton 73f4bfed81 Move Matches() file path matching function into pkg/fileutils
This is the second of two steps to break the archive package's
dependence on utils so that archive may be moved into pkg. `Matches()`
is also a good candidate pkg in that it is small, concise, and not
specific to docker internals

Signed-off-by: Rafe Colton <rafael.colton@gmail.com>
2014-09-29 23:21:41 -07:00