mocktools / go-smtp-mock

SMTP mock server written on Golang. Mimic any 📤 SMTP server behavior for your test environment with fake SMTP server.
MIT License
124 stars 17 forks source link

[BUG] BrokenImport, could not import (no required module provides package) #137

Closed TechDufus closed 1 year ago

TechDufus commented 1 year ago

New bug checklist

Bug description

When following the instructions on installing / importing in Go, I'm running into the following issue...

  1. Install smtpmock:

    go get github.com/mocktools/go-smtp-mock/v2
    go install github.com/mocktools/go-smtp-mock/v2/smtpmock@latest

    Output: go: github.com/mocktools/go-smtp-mock/v2/smtpmock@latest: module github.com/mocktools/go-smtp-mock/v2@latest found (v2.0.1), but does not contain package github.com/mocktools/go-smtp-mock/v2/smtpmock

  2. Import statement error in go package:

    compiler: could not import github.com/mocktools/go-smtp-mock/v2 (no required module provides package "github.com/mocktools/go-smtp-mock/v2") [BrokenImport]

Am I doing something obviously wrong?

I'm using go version go1.19.3 linux/amd64

bestwebua commented 1 year ago

Hi, @TechDufus! Thanks. Seems like we need to update docs 👍 Could you try these commands?:

# clean your go mod cache
go clean -modcache

# init your go.mod if it not exists
go mod init you_module_name

# install smtpmock
go get github.com/mocktools/go-smtp-mock/v2
go install github.com/mocktools/go-smtp-mock/v2

After you can add smtpmock into your code:

// main.go

package main

import smtpmock "github.com/mocktools/go-smtp-mock/v2"

func main() {
  smtpmock.ConfigurationAttr{}
}

That's all.

TechDufus commented 1 year ago

This did the trick... THANK YOU... Now I'm off to break this mock implementation.... ;)

bestwebua commented 1 year ago

Good luck 😃