Open sklirg opened 5 years ago
Instead of regex, could standard file globing be used?
Zglob (which is used in this project already) assumes the files are on disk, but they are not, they're in S3.
I quickly looked up some libraries for globbing in golang, but being unfamiliar with them as well as not wanting to add further dependencies to the project I went with regex.
I'm open to switching to globs instead, if you have a library for this in mind. :)
the filepath
package in the Go standard library supports globbing using filepath.Match
. For consistency we should use globbing instead of regular expressions.
the only downside to the Go standard library is that they do not support **
syntax. This is why we use zglob
in this particular plugin. We also use bmatcuk/doublestar in many other Drone projects.
Alright, I'll have a look at using those libs instead. Thanks for the pointers!
I found the main (plugin) function to get quite big, should I split out this feature out into a new function to make it easier to test etc.?
I rewrote it to use the globbing provided by doublestar now. Feel free to give any further comments. :)
I've renamed the variables :)
Hi there!
Today I tried out this plugin and I really like it.
I'm uploading files for a "static website" and they are generated with hashes in the filenames for cache busting. Rather than removing the hashes, I'd like to remove some files from the bucket before I upload new ones.
It's a long time since I wrote some Go code, so feel free to comment on it.
I'm also unfamiliar with any special conventions for Drone plugins, so I'm open for suggestions.
Best regards, Sklirg