<commit_before>package main

import (
	"flag"
	"fmt"
	"log"
	"os"
	"strconv"
	"syscall"

	"github.com/crowdmob/goamz/aws"
	"github.com/crowdmob/goamz/s3"
)

var logger *log.Logger

// flags
var awsKey string
var awsSecret string
var s3Region string
var start int
var end int
var width int
var bucket string
var prefix string

func main() {
	if bucket == "" {
		logger.Println("Bucket not specified")
		syscall.Exit(1)
	}

	auth := new(aws.Auth)
	auth.AccessKey = awsKey
	auth.SecretKey = awsSecret
	s3c := s3.New(*auth, aws.Regions[s3Region])
	s3bucket := s3c.Bucket(bucket)
	logger.Println(s3bucket)

	// making i with leading zeros with this format
	format := "%0" + strconv.Itoa(width) + "d"
	for i := start; i <= end; i += 1 {
		suffix := fmt.Sprintf(format, i)
		key := prefix + suffix
		logger.Printf("Deleting S3 key: %s", key)
		err := s3bucket.Del(key)
		if err != nil {
			logger.Printf("Got error deleting key: %s", err)
		}
	}
}

func init() {
	logger = log.New(os.Stdout, "", 0)

	flag.StringVar(&awsKey, "awsKey", os.Getenv("AWS_ACCESS_KEY_ID"), "AWS Key. Defaults to env var AWS_ACCESS_KEY_ID")
	flag.StringVar(&awsSecret, "awsSecret", os.Getenv("AWS_SECRET_KEY"), "AWS Secret. Defaults to env var AWS_SECRET_KEY")
	flag.StringVar(&s3Region, "s3Region", "us-east-1", "AWS S3 region")
	flag.IntVar(&start, "start", 0, "Starting number")
	flag.IntVar(&end, "end", 0, "Ending number (inclusive)")
	flag.IntVar(&width, "width", 6, "Key number width (ex. when width = 6, 1 = 000001)")
	flag.StringVar(&bucket, "bucket", "", "Bucket")
	flag.StringVar(&prefix, "prefix", "/", "Key prefix")
	flag.Parse()
}<commit_msg>better logging. strconv package removed for fmt<commit_after>package main

import (
	"flag"
	"fmt"
	"log"
	"os"
	"syscall"

	"github.com/crowdmob/goamz/aws"
	"github.com/crowdmob/goamz/s3"
)

var logger *log.Logger

// flags
var awsKey string
var awsSecret string
var s3Region string
var start int
var end int
var width int
var bucket string
var prefix string

func main() {
	if bucket == "" {
		logger.Println("Bucket not specified")
		syscall.Exit(1)
	}

	auth := new(aws.Auth)
	auth.AccessKey = awsKey
	auth.SecretKey = awsSecret
	s3c := s3.New(*auth, aws.Regions[s3Region])
	s3bucket := s3c.Bucket(bucket)

	// making i with leading zeros with this format
	format := fmt.Sprintf("%%0%dd", width)
	for i := start; i <= end; i += 1 {
		suffix := fmt.Sprintf(format, i)
		key := prefix + suffix
		logger.Printf("Deleting S3 key: %s%s", bucket, key)
		err := s3bucket.Del(key)
		if err != nil {
			logger.Printf("Got error deleting key: %s", err)
		}
	}
}

func init() {
	logger = log.New(os.Stdout, "", 0)

	flag.StringVar(&awsKey, "awsKey", os.Getenv("AWS_ACCESS_KEY_ID"), "AWS Key. Defaults to env var AWS_ACCESS_KEY_ID")
	flag.StringVar(&awsSecret, "awsSecret", os.Getenv("AWS_SECRET_KEY"), "AWS Secret. Defaults to env var AWS_SECRET_KEY")
	flag.StringVar(&s3Region, "s3Region", "us-east-1", "AWS S3 region")
	flag.IntVar(&start, "start", 0, "Starting number")
	flag.IntVar(&end, "end", 0, "Ending number (inclusive)")
	flag.IntVar(&width, "width", 6, "Key number width (ex. when width = 6, 1 = 000001)")
	flag.StringVar(&bucket, "bucket", "", "Bucket")
	flag.StringVar(&prefix, "prefix", "/", "Key prefix")
	flag.Parse()
}
{'fraction_non_alphanumeric': 0.16446357208730403, 'fraction_numerical': 0.017522287119581925, 'mean_word_length': 4.3607907742998355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3541635', 'n_tokens_mistral': 1317, 'n_tokens_neox': 1254, 'n_words': 328}