John defines the gospel message of Jesus Christ this way:
This is the message we have heard from him and proclaim to you, that God is light and in him there is no darkness at all. If we say that we have fellowship with him while we are walking in darkness, we lie and do not do what is true; but if we walk in the light as he himself is in the light, we have fellowship with one another, and the blood of Jesus his Son cleanses us from all sin. If we say that we have no sin, we deceive ourselves, and the truth is not in us. If we confess our sins, he who is faithful and just will forgive us our sins and cleanse us from all unrighteousness. If we say that we have not sinned, we make him a liar, and his word is not in us (1 John 1.5-10).
It appears to me that an important element of this gospel message is its rhetorical and ethical function. Jesus' message is intended to put the hearer in a state of critical self-evaluation. Of course, God is light does not tell us much at all; John is merely abbreviating and summarizing what Jesus expounds in greater detail in his gospel. The point, however, is this: the person hearing Jesus' message has to consider his own life and ask himself the question, Am I in the dark or am I in the light?
Too often people simply live life on auto-pilot, not thinking about what they do, not evaluating or questioning their motives. They assume that whatever they feel or want to do in the moment is right. But Jesus' message is a resounding denial of our unthinking acceptance of ourselves. Implied in this message is that inevitably, there will be some darkness in our life. Thus John informs us that part of Jesus' message is this: if you say you have no sin, you're in the darkness and you are turning God into a liar.
Yet part of the message is also God's willingness to forgive. John says that if we only confess our sins -- if we only admit that we were in the wrong, that we judged wrongly and that we have not been living the sort of life that God wants of us -- God is happy to forgive us and cleanse us of all our sins on the basis of that act of recognition. We do not have to perform any costly acts of atonement; Christ himself has given himself for our sins! All we must do is acknowledge that we goofed, and learn from God what is right, and we will have fellowship with him.
Interestingly, John says that God is faithful and just to forgive us. He is faithful because it is his promise and also his character to forgive. He doesn't change who he is; therefore we can trust that he will forgive us if we admit fault. But also, God is just or righteous [δίκαιος] to forgive us if we confess. I think this is radical stuff. Typically we understand forgiveness as a kind of supererogatory act of grace, one that a person in principle could not be obligated to perform. Yet John here says that it is a part of δικαιοσύνη, a part of righteousness or justice, to forgive the person who confesses his sins. This presumes a different ethical understanding. Perhaps this is a part of the way that God is in the light yet we are in the darkness: we think of forgiveness as optional, whereas God loves to forgive and it is a part of his righteousness as such to forgive.