modulepackage
0.0.2
Repository: https://github.com/lordbrain/date_changer.git
Documentation: pkg.go.dev
# README
date_changer
Homework details can be found here.
Assumptions
- A single file will be used
- A original date format will be entered
- A desired date format will be entered
- Date formats are valid RFC formats
The file will be read in, and a output file will be created with the new date format used.
Building
- Install golang, make sure it is at least version 1.20.
- Pull repo from github.
- Make sure you are in the root of the project
- Update packages with command:
go mod tidy
- To run the app without building a binary:
go run main.go
. - Building the binary:
- For building on your local machine:
go build .
- For Mac Silicon:
GOOS=darwin GOARCH=arm64 go build .
- For Mac Intel:
GOOS=darwin GOARCH=amd64 go build .
- For Linux amd64:
GOOS=linux GOARCH=amd64 go build .
- For Linux arm:
GOOS=linux GOARCH=arm64 go build .
- For Windows amd64:
GOOS=windows GOARCH=amd64 go build .
- For all possiable build options checkout this gist.
- For building on your local machine:
Testing
To run all the test, in the root of the project run go test ./...
. This will run all the tests in the project
Running
This is a command line interface application.
Follow the build steps above, you can run the app without building, or create a binary for your OS.
date_changer is used to replace a date format with a new one within a file.
It will replace all matching date formats with a new specified one.
example:
date_changer ~/Download/textfile.txt -o RFC822 -n RFC850 -output newtextfile.txt
Allowed date formats: ANSIC,UnixDate,RubyDate,RFC822,RFC822Z,RFC850,RFC1123,RFC1123Z,RFC3339,RFC3339Nano,DateTime
A example file can be found in the example_files folder. To test with it run the following command from the root of the project: go run main.go example_files/SampleData.txt -o RFC3339 -n UnixDate