- Go 1.19 or higher
- Fork the repository and clone it locally
- Run
go mod download
to download dependencies - Run
go test ./...
to run all tests
The tests are located in the matchers
, devices
, platforms
and browser
packages. The tests are using the assets/test
directory to load the user agents data.
Package follows BDD style test cases. The tests are using the GoConvey library to write BDD style tests.
Every browser implements the BrowserMatcher
interface.
- Add the file to the
matchers
package. - Add the new browser the list of matchers in
browser.go
. Make sure the order of the matchers is correct. The order of the matchers is important because the first matcher that returnstrue
will be used. - Add specific tests for the new browser in the
matchers
package. Make sure to test all the possible user agents for the browser. You can use this website to find user agents for the browser. - Add the user agents data to matchers.yml file.
- Add all necerssary functions to
Browser
struct inbrowser.go
file.
Every device implements the DeviceMatcher
interface.
- Add the file to the
devices
package. - Add the new device to list of
DeviceMatcher
indevice.go
. Make sure the order of the matchers is correct. The order of the matchers is important because the first matcher that returnstrue
will be used. - Add specific tests for the new device in the
devices
package. Make sure to test all the possible user agents for the device. You can use this website to find user agents for the device. - Add the user agents data to devices.yml file.
- Add all necerssary functions to
Device
struct indevice.go
file.
Every platform implements the PlatformMatcher
interface.
- Add the file to the
platforms
package. - Add the new platform to list of
PlatformMatcher
inplatform.go
. Make sure the order of the matchers is correct. The order of the matchers is important because the first matcher that returnstrue
will be used. - Add specific tests for the new platform in the
platforms
package. Make sure to test all the possible user agents for the platform. You can use this website to find user agents for the platform. - Add the user agents data to platforms.yml file.
- Add all necerssary functions to
Platform
struct inplatform.go
file.
- Add the new bot to known_bots.yml.