A command-line temperature conversion application built in Go that converts Celsius temperatures to Fahrenheit and Réaumur scales, with location-based measurements and temperature classification.
- 🌡️ Temperature Conversion: Convert Celsius to Fahrenheit and Réaumur
- 📍 Location Tracking: Record the location where temperature is measured
- 🏷️ Temperature Classification: Automatically classify temperatures as:
- ❄️ Dingin (Cold): Below 18°C
- 🌤️ Hangat (Warm): 18°C - 25°C
- 🔥 Panas (Hot): Above 25°C
- ✅ Input Validation:
- Location must be alphabetic characters and spaces only
- Temperature must be numeric values
- 🏗️ Clean Architecture: Uses structs and pointer-based functions for efficient memory usage
- Go 1.21 or higher
- Git
# Clone the repository
git clone https://github.com/muslchn/temperature-conversion.git
# Navigate to project directory
cd temperature-conversion
# Build the application
go build -o temperature-converter .
# Run the application
./temperature-convertergo install github.com/muslchn/temperature-conversion@latestRun the application and follow the prompts:
./temperature-converter--- Konverter Suhu ---
Masukkan lokasi pengukuran suhu: Jakarta
Masukkan suhu dalam Celsius: 25
> Suhu di Jakarta adalah hangat
> Suhu di Jakarta dalam Reamur = 20.00
> Suhu di Jakarta dalam Fahrenheit = 77.00
The application provides clear error messages for invalid inputs:
--- Konverter Suhu ---
Masukkan lokasi pengukuran suhu: Madinah
Masukkan suhu dalam Celsius: dua puluh lima
> input tidak valid, hanya menerima angka
The application is built using clean architecture principles:
- Struct-based Data Management: Uses
TemperatureDatastruct to encapsulate location and temperature information - Pointer-based Functions: Implements pass-by-reference for efficient memory usage
- Separation of Concerns: Clear separation between input validation, business logic, and output formatting
type TemperatureData struct {
Location string
Celsius float64
}- Fahrenheit:
F = (C × 9/5) + 32 - Réaumur:
R = C × 4/5
| Category | Temperature Range (°C) | Description |
|---|---|---|
| Dingin | < 18 | Cold |
| Hangat | 18 - 25 | Warm |
| Panas | > 25 | Hot |
temperature-conversion/
├── .github/
│ └── workflows/
│ └── ci.yml # GitHub Actions CI/CD pipeline
├── main.go # Main application code
├── go.mod # Go module definition
├── temperature-converter # Compiled binary
└── README.md # This file
# Download dependencies
go mod download
# Build the application
go build -o temperature-converter .
# Run tests (when available)
go test ./...
# Run linting
go vet ./...This project maintains high code quality standards:
- Static Analysis: Uses
staticcheckfor advanced Go linting - Code Formatting: Follows
gofmtstandards - Error Handling: Implements proper error handling patterns
- Input Validation: Comprehensive input validation for user safety
The project uses GitHub Actions for continuous integration:
- Automated Testing: Runs on every push and pull request
- Multiple Go Versions: Tested against Go 1.21+
- Static Analysis: Includes
go vetandstaticcheck - Build Verification: Ensures clean builds across platforms
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Go naming conventions
- Add tests for new features
- Ensure all CI checks pass
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
- Built as part of learning Go programming fundamentals
- Focuses on practical application of structs, pointers, and input validation
- Implements clean architecture patterns for maintainable code
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Follow the issue template for faster resolution
Made with ❤️ and Go