GithubHelp home page GithubHelp logo

Including an IMAP server about go-imap HOT 4 OPEN

xarg avatar xarg commented on June 12, 2024
Including an IMAP server

from go-imap.

Comments (4)

mxk avatar mxk commented on June 12, 2024

I've been following that discussion on golang-nuts. Right now, I don't have much time to spend on a new project. You are welcome to take any code from the client and adapt it for the server, but I don't really see a benefit in combining the two. How often does an application need to be both?

For testing the client, you want to be absolutely certain that the server isn't doing something wrong. That's what the mock package gives you in a minimal amount of code. Why replace it by a real server and introduce the possibility of a client test failing because the server does something unexpected?

from go-imap.

xarg avatar xarg commented on June 12, 2024

How often do you need an http client and a server in the same package? I'm talking about net/http of course. So the answer is: not very often, but when you do it kind of makes sense to have both in the same place and not look around. Also: code reuse.

On the subject of mocking, it's more philosophical I guess. Mocking is nice to have for doing fast and reproducible tests, but in a world were everything brakes all the time nothing can replace a real server that has to open sockets and has to use disk and memory, etc... I would very much prefer to test a library against that kind of a server (it can be a postfix in a docker image - doesn't really matter). A mock will give you a 'false' sense of security. This is just my opinion - a lot of people don't agree with me.

I suggest having both: mocking for fast tests and a reals server in a virtualbox somewhere to do the long tests with lots of stuff breaking left and right. Fabric (python) project uses this technique for example.

Since you guys don't have time for this I think I'll fork both projects and try to merge them. I need both, so it makes sense for me to do that.

from go-imap.

mxk avatar mxk commented on June 12, 2024

You're right about code reuse, my only concern would be the introduction of many new dependencies that aren't necessary for the client. It's a question of how much functionality you want the server to have. I haven't thought much about it, but it seems to me that even a basic IMAP server would be more complex than a basic HTTP server. There is more state to keep track of and data storage is pretty much a requirement for IMAP, whereas HTTP can easily work with only dynamically generated content.

from go-imap.

xarg avatar xarg commented on June 12, 2024

The server doesn't implement a storage on it's own. It offers interfaces for storage (sql, maildir, etc..), authentication.. The idea is that 3rd parties would implement maildir/sql/etc.. packages that comply to the mail storage interface. A la: http://golang.org/pkg/database/sql/

At least that is the plan at this moment.

The server itself could include some dummy storages to demonstrate the functionality, but it's beyond of it's scope to handle every possible mail store.

The implementation of even a basic server could be big and hairy, but I can't see why it would increase the complexity of the client.

from go-imap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.