Swephgo
Golang interface binding to the Swiss Ephemeris C library.
Install / Use
/learn @mshafiee/SwephgoREADME
SwEphGo
Golang interface binding to the Swiss Ephemeris C library v2.10.03.
Swiss Ephemeris is a powerful and versatile astronomical calculation library that serves the needs of astrologers, archeoastronomers, and, depending on the purpose, also astronomers. It includes long-term ephemerides for the Sun, the Moon, the planets, over 300,000 asteroids, historically relevant fixed stars, and some hypothetical objects.
Installation
To get started with using SwEphGo, you'll first need to install the Swiss Ephemeris Library. You can download it here and then follow these installation steps:
- To compile the library, navigate to the
srcfolder of the downloaded library and executemake libswe.so. In some environments, you may need to modify the build command by adding-lm -ldltolibswe.soin theMakefile. Here's the updated Makefile code:
libswe.so: $(SWEOBJ)
$(CC) -shared -o libswe.so $(SWEOBJ) -lm -ldl
- After compiling the library, copy the
libswe.sofile to/usr/local/lib/.
$ cp libswe.so /usr/local/lib/
- Get the library with the following command:
$ go get github.com/mshafiee/swephgo
Usage
Once you have the library installed, you can use it in your Go projects by importing it in the main package and calling the Version function to print out the version of the library being used. For example, you can use the following code:
package main
import (
"fmt"
"github.com/mshafiee/swephgo"
)
func main() {
sweVer := make([]byte, 12)
swephgo.Version(sweVer)
fmt.Printf("Library used: Swiss Ephemeris v%s\n", sweVer)
}
To run the code above:
$ go run main.go
The output will be:
Library used: Swiss Ephemeris v2.10.03
Disclaimer
This project includes C header files taken from the SWISSEPH source code. These rights belong to Astrodienst AG, Switzerland. For information on how to use the rights of these files, please visit the Swiss Ephemeris website. The developer of this library is not affiliated with Astrodienst AG and this library is provided as is, without warranty of any kind, express or implied.
Related Skills
node-connect
345.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
345.9kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
frontend-design
106.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
