Compare commits

...

22 Commits
v0.0.1 ... main

Author SHA1 Message Date
7281b9b678 add new option "-v"
All checks were successful
Release Version / build (push) Successful in 5m25s
2024-09-29 13:40:49 +02:00
cdaf3d081e Merge branch 'main' of https://git.fluffy.pw/leafus/s3-client
All checks were successful
Release Version / build (push) Successful in 5m30s
2024-09-29 13:28:08 +02:00
425cf609cc Add -overwrite function 2024-09-29 13:28:06 +02:00
8bde3ccb90 Update .gitea/workflows/build.yaml
All checks were successful
Release Version / build (push) Successful in 5m33s
2024-09-29 13:02:55 +02:00
915245e9da Update .gitea/workflows/build.yaml
All checks were successful
Release Version / build (push) Successful in 8s
2024-09-29 13:01:03 +02:00
20c9b45561 Update .gitea/workflows/build.yaml
All checks were successful
Release Version / build (push) Successful in 7s
2024-09-29 13:00:48 +02:00
5c518abcdc Update .gitea/workflows/build.yaml
All checks were successful
Release Version / build (push) Successful in 8s
2024-09-29 13:00:21 +02:00
431787d061 Update main.go
All checks were successful
Release Version / build (push) Successful in 6s
2024-09-29 12:59:14 +02:00
a9f0f3cbbc fix Mac OS target
All checks were successful
Release Version / build (push) Successful in 7s
2024-09-29 12:58:52 +02:00
563b11fd33 Merge branch 'main' of https://git.fluffy.pw/leafus/s3-client
All checks were successful
Release Version / build (push) Successful in 7s
2024-09-29 12:56:37 +02:00
a18fe3c1e6 add Mac OS target
All checks were successful
Release Version / build (push) Successful in 9s
2024-09-29 12:55:58 +02:00
87df3b82d5 Add file not existent handling 2024-09-29 12:54:56 +02:00
05240851aa add new targets
All checks were successful
Release Version / build (push) Successful in 8s
2024-09-29 12:45:59 +02:00
e72a7a7468 Merge branch 'main' of https://git.fluffy.pw/leafus/s3-client
All checks were successful
Release Version / build (push) Successful in 6s
2024-09-29 05:11:32 +02:00
d8049b0e00 Change README.md 2024-09-29 05:11:30 +02:00
5e68824953 Update .gitea/workflows/build.yaml
All checks were successful
Release Version / build (push) Successful in 7s
2024-09-29 05:08:54 +02:00
7eb9f7ce4a Update .gitea/workflows/build.yaml
All checks were successful
Release Version / build (push) Successful in 8s
2024-09-29 05:07:22 +02:00
55bc83b82b Merge branch 'main' of https://git.fluffy.pw/leafus/s3-client
All checks were successful
Release Version / build (push) Successful in 1m17s
2024-09-29 04:59:20 +02:00
156d1a3e23 Add file deletion and ignore s3-client-dev 2024-09-29 04:58:53 +02:00
b9836c393d Update .gitea/workflows/build.yaml
All checks were successful
Release Version / build (push) Successful in 1m16s
2024-09-29 04:50:34 +02:00
40dda8edfc Update .gitea/workflows/build.yaml
Some checks failed
Release Version / build (push) Failing after 1m14s
2024-09-29 04:46:37 +02:00
4d4ecf8c11 Update .gitea/workflows/build.yaml
Some checks failed
Release Version / build (push) Failing after 1m14s
2024-09-29 04:43:26 +02:00
6 changed files with 189 additions and 18 deletions

View File

@ -18,10 +18,54 @@ jobs:
with: with:
go-version: '1.23.1' go-version: '1.23.1'
- name: Build Go binary - name: Build Go binary for Linux
run: | run: |
go mod tidy go mod tidy
go build -o s3-client go build -o s3-client_linux.x86_64
- name: Build Go binary for Linux (x86)
run: |
go mod tidy
GOARCH=386 go build -o s3-client_linux.x86
- name: Build Go binary for Linux (ARM64)
run: |
go mod tidy
GOARCH=arm64 go build -o s3-client_linux.arm64
- name: Build Go binary for Mac OS (x86_64)
run: |
go mod tidy
GOOS=darwin GOARCH=amd64 go build -o s3-client_darwin.x86_64.app
- name: Build Go binary for Mac OS (ARM64)
run: |
go mod tidy
GOOS=darwin GOARCH=arm64 go build -o s3-client_darwin.arm64.app
- name: Build Go binary for Linux (ARMv7)
run: |
go mod tidy
GOARCH=arm go build -o s3-client_linux.armv7
- name: Build Go binary for Linux (RISC-V)
run: |
go mod tidy
GOARCH=riscv64 go build -o s3-client_linux.riscv64
- name: Build Go binary for Windows
run: |
GOOS=windows GOARCH=amd64 go build -o s3-client_windows.x86_64.exe
- name: Build Go binary for Windows (x86)
run: |
go mod tidy
GOOS=windows GOARCH=386 go build -o s3-client_windows.x86.exe
- name: Build Go binary for Windows (ARM64)
run: |
go mod tidy
GOOS=windows GOARCH=arm64 go build -o s3-client_windows.arm64.exe
- name: Get latest commit ID - name: Get latest commit ID
id: get_commit id: get_commit
@ -32,15 +76,27 @@ jobs:
- name: Get latest version and increment - name: Get latest version and increment
id: create_version id: create_version
run: | run: |
latest_version=$(git describe --tags --abbrev=0 || echo "v0.0.0") if [ "${{ env.main_go_modified }}" = "false" ]; then
echo "No changes in main.go, skipping version increment and release creation."
exit 0
fi
git fetch --tags
latest_version=$(git tag | sort -V | tail -n 1 || echo "v0.0.0")
new_version=$(echo $latest_version | awk -F. '{printf "v%d.%d.%d", $1, $2, $3+1}') new_version=$(echo $latest_version | awk -F. '{printf "v%d.%d.%d", $1, $2, $3+1}')
while git rev-parse "$new_version" >/dev/null 2>&1; do
new_version=$(echo $new_version | awk -F. '{$3+=1; printf "v%d.%d.%d", $1, $2, $3}')
done
echo "latest_version=$latest_version" >> $GITHUB_ENV
echo "new_version=$new_version" >> $GITHUB_ENV
if git rev-parse "$new_version" >/dev/null 2>&1; then if git rev-parse "$new_version" >/dev/null 2>&1; then
echo "Tag $new_version already exists. Exiting." echo "Tag $new_version already exists. Exiting."
exit 1 exit 1
fi fi
echo "new_version=$new_version" >> $GITHUB_ENV
git tag $new_version git tag $new_version
git push origin $new_version git push origin $new_version
@ -61,10 +117,26 @@ jobs:
GITEA_TOKEN: ${{ secrets.TOKEN }} GITEA_TOKEN: ${{ secrets.TOKEN }}
GITHUB_TOKEN: ${{ secrets.TOKEN }} GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: Upload Go binary to release - name: Upload Go binaries to release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
files: ./s3-client files: |
./s3-client_linux.x86_64
./s3-client_linux.x86
./s3-client_linux.armv7
./s3-client_linux.arm64
./s3-client_linux.riscv64
./s3-client_windows.x86_64.exe
./s3-client_windows.x86.exe
./s3-client_windows.arm64.exe
./s3-client_darwin.x86_64.app
./s3-client_darwin.arm64.app
tag_name: ${{ env.new_version }} tag_name: ${{ env.new_version }}
name: Release ${{ env.new_version }}
body: |
Automatic release by Gitea CI
Release version ${{ env.new_version }}.
Commit ID: ${{ env.commit_id }}
env: env:
GITHUB_TOKEN: ${{ secrets.TOKEN }} GITHUB_TOKEN: ${{ secrets.TOKEN }}

3
.gitignore vendored
View File

@ -1 +1,2 @@
s3config.toml s3config.toml
s3-client-dev

View File

@ -42,13 +42,23 @@ returnurl = "your_return_url"
### Upload a file ### Upload a file
``` ```
./s3-client -file "path/to/your/file" [optional] -directory "/exampledir" ./s3-client_linux.x86_64 -file "path/to/your/file" [optional] -directory "/exampledir"
``` ```
### List files ### List files
``` ```
./s3-client -list ./s3-client_linux.x86_64 -list
```
### Delete files
```
./s3-client_linux.x86_64 -delete "filename.png"
or with an directory
./s3-client_linux.x86_64 -delete "/dir1/filename.png"
``` ```
### Help message ### Help message

10
go.mod
View File

@ -12,11 +12,12 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/rivo/uniseg v0.2.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect
@ -28,7 +29,8 @@ require (
go.uber.org/atomic v1.9.0 // indirect go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/sys v0.18.0 // indirect golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.14.0 // indirect golang.org/x/text v0.14.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect

12
go.sum
View File

@ -22,8 +22,14 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
@ -31,6 +37,8 @@ github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
@ -66,6 +74,10 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM=
golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

80
main.go
View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"bufio"
"flag" "flag"
"fmt" "fmt"
"os" "os"
@ -20,8 +21,22 @@ func main() {
configPath := flag.String("config", "", "Path to the configuration file") configPath := flag.String("config", "", "Path to the configuration file")
directory := flag.String("directory", "", "Directory in the S3 bucket to upload the file to") directory := flag.String("directory", "", "Directory in the S3 bucket to upload the file to")
listFiles := flag.Bool("list", false, "List files in the S3 bucket") listFiles := flag.Bool("list", false, "List files in the S3 bucket")
deleteFile := flag.String("delete", "", "Path to the file to delete from the S3 bucket")
overwrite := flag.Bool("overwrite", false, "Overwrite the file if it already exists on S3")
verbose := flag.Bool("v", false, "Enable verbose output")
flag.Parse() flag.Parse()
if *verbose {
fmt.Println("Debug Information:")
fmt.Printf("File Path: %s\n", *filePath)
fmt.Printf("Force Path Style: %t\n", *forcePathStyle)
fmt.Printf("Config Path: %s\n", *configPath)
fmt.Printf("Directory: %s\n", *directory)
fmt.Printf("List Files: %t\n", *listFiles)
fmt.Printf("Delete File: %s\n", *deleteFile)
fmt.Printf("Overwrite: %t\n", *overwrite)
}
if *configPath == "" { if *configPath == "" {
homeDir, err := os.UserHomeDir() homeDir, err := os.UserHomeDir()
if err != nil { if err != nil {
@ -42,7 +57,7 @@ func main() {
} }
if *configPath == "" { if *configPath == "" {
fmt.Println("No config file found. Please specify a config file using --config or create one in the default locations.") fmt.Println("No config file found. Please specify a config file using -config or create one in the default locations.")
os.Exit(1) os.Exit(1)
} }
} }
@ -80,12 +95,22 @@ func main() {
return return
} }
if *deleteFile != "" {
deleteS3File(svc, bucket, *deleteFile)
return
}
if *filePath == "" { if *filePath == "" {
fmt.Println("No file specified for upload. Use -file to specify a file or -list to list bucket contents.") fmt.Println("No file specified for upload. Use -file to specify a file or -list to list bucket contents.")
fmt.Println("Use -help for more information") fmt.Println("Use -help for more information")
os.Exit(1) os.Exit(1)
} }
if _, err := os.Stat(*filePath); os.IsNotExist(err) {
fmt.Printf("File does not exist: %s\n", *filePath)
os.Exit(1)
}
file, err := os.Open(*filePath) file, err := os.Open(*filePath)
if err != nil { if err != nil {
fmt.Printf("Error opening file: %s\n", err) fmt.Printf("Error opening file: %s\n", err)
@ -102,17 +127,41 @@ func main() {
} }
key = filepath.ToSlash(key) key = filepath.ToSlash(key)
_, err = svc.PutObject(&s3.PutObjectInput{ headObjectInput := &s3.HeadObjectInput{
Bucket: aws.String(bucket),
Key: aws.String(key),
}
_, err = svc.HeadObject(headObjectInput)
if err == nil && !*overwrite {
reader := bufio.NewReader(os.Stdin)
fmt.Printf("The file with the same filename already exists on S3. Do you want to overwrite? [y/n] > ")
response, _ := reader.ReadString('\n')
response = strings.TrimSpace(response)
if strings.ToLower(response) != "y" {
fmt.Println("Upload cancelled.")
os.Exit(0)
}
}
putObjectInput := &s3.PutObjectInput{
Bucket: aws.String(bucket), Bucket: aws.String(bucket),
Key: aws.String(key), Key: aws.String(key),
Body: file, Body: file,
}) }
req, _ := svc.PutObjectRequest(putObjectInput)
err = req.Send()
if err != nil { if err != nil {
fmt.Printf("Error uploading file to S3: %s\n", err) fmt.Printf("Error uploading file to S3: %s\n", err)
os.Exit(1) os.Exit(1)
} }
if *verbose {
fmt.Printf("Uploaded file: %s\n", *filePath)
fmt.Printf("Endpoint: %s\n", endpoint)
fmt.Printf("HTTP Status Code: %d\n", req.HTTPResponse.StatusCode)
}
fullURL := fmt.Sprintf("%s/%s", fullURL := fmt.Sprintf("%s/%s",
strings.TrimRight(returnurl, "/"), strings.TrimRight(returnurl, "/"),
strings.TrimLeft(key, "/")) strings.TrimLeft(key, "/"))
@ -141,3 +190,28 @@ func listBucketFiles(svc *s3.S3, bucket string) {
os.Exit(1) os.Exit(1)
} }
} }
func deleteS3File(svc *s3.S3, bucket, filePath string) {
filePath = strings.TrimPrefix(filePath, "/")
_, err := svc.DeleteObject(&s3.DeleteObjectInput{
Bucket: aws.String(bucket),
Key: aws.String(filePath),
})
if err != nil {
fmt.Printf("Error deleting file from S3: %s\n", err)
os.Exit(1)
}
err = svc.WaitUntilObjectNotExists(&s3.HeadObjectInput{
Bucket: aws.String(bucket),
Key: aws.String(filePath),
})
if err != nil {
fmt.Printf("Error waiting for file deletion: %s\n", err)
os.Exit(1)
}
fmt.Printf("Successfully deleted file: %s\n", filePath)
}