This is the message we have heard from him and proclaim to you, that God is light, and in him is no darkness at all.  If we say we have fellowship with him while we walk in darkness, we lie and do not practice the truth.  But if we walk in the light, as he 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 we have no sin, we deceive ourselves, and the truth is not in us.  If we confess our sins, he is faithful and just to forgive us our sins and to cleanse us from all unrighteousness.  If we say we have not sinned, we make him a liar, and his word is not in us. (1 John 1:5-10 ESV)
What we saw in verses 1-4 is that St. John is very interested in speaking to his hearers/readers about the life-- the Word of Life, eternal life. But as we saw, the life itself that he refers to is embodied in Jesus Christ. Jesus Christ is the Word of Life and the wellspring of eternal life. Indeed, the life was "made manifest" and was "seen and touched" by John and the apostles in the person of Jesus Christ (v. 2).
Now, going a step further John tells us what it is that this Word of Life made manifest has spoken and has given them to proclaim. For the one who is to have fellowship with God and with those who have been brought into the divine life of the Trinity, those who have seen and touched the life incarnate, namely Jesus, must hear the message that this incarnate Word of life proclaims and live by it. That is, they must live the life that they receive. And what is that message?
Here we must recognize that John is not going to scratch our modern itch for simple, 'straightforward' answers. He has not spoken metaphorically in order to pique our interest so that now he can give us the straight dope. Rather, John speaks in the language of Scripture (which is the language of symbol) to a greater degree than perhaps any other New Testament author. And so the message that he speaks of is yet again a picture. Jesus has been pictured as a Word and as Life itself, indeed as the Word of Life, and now the message of this one who is the Word of Life comes to us: God is light, and in him is no darkness at all! The Word made visible speaks a visible word.
But this is no cryptic puzzle. This is not a Delphic oracle (a mysterious saying from one of the hidden ‘gods’ of the ancients). In this case, a picture truly is worth a thousand words. Indeed how could John have said this apart from using such pictorial language? God is light!
This brings us back to the Word of Life made manifest. Jesus Christ is the Word and the Life and having been made manifest to John and the holy apostles he is made manifest to us (by this proclamation) as we are brought into his life, because his life is light. It is by his life, which we share in if we have fellowship with Him and His Father and His children, that we see, because his life is light. Notice how these images swirl back upon themselves. The Word of Life (Jesus Christ) was manifested because the Word of Life is the Word and Life of God, and the Word and the Life are visible precisely because God is light.
Thus to have fellowship with God is to walk in the light; that is, to see clearly and to see things as they are, illuminated by the life of God and his Word with which we have fellowship. Perhaps that is why later John will tell us that we “have no need that anyone should teach [us]” (2.27)
But there is a flip-side to this good news. Namely that if we walk in darkness, if we walk as those who do not see, or who turn their eyes away from the light of God’s good will and walk in darkness, it is only through lies and deception that we claim fellowship with him. At this point it is important for us to remember one of the chief burdens of John’s letter. He is writing to give assurance to believers that they are, in fact, children of God (1.12-14, 3.1-3, etc.). Indeed, we see in the next few verses that John is quick to remind us of the forgiveness that we have when we sin. Thus, his point is not that if we dabble in darkness we do not have fellowship with God; for indeed we all do dabble, but “the blood of Jesus his Son cleanses us from all sin” (v. 7b). In fact, John will tell us almost immediately that if we deny that we have sin, that is if we deny dabbling in darkness at times, we are deceiving ourselves. This is no contradiction, and in fact it is a tension that we will need to hang on to in order to navigate the rest of John’s letter.
Further, if we are well schooled in our Old Testament we will not be surprised by such a distinction. In the law (contrary to some popular modern reformed authors) there are many provisions for dealing with ‘sins of wandering,’ or what is sometimes translated ‘accidental’ or ‘inadvertent’ sin. However, it is clear that these are not just sins done by mistake, but sins done apart from high-handed rebellion. These are the sins committed by all faithful Christians in the course of life which the blood of Christ covers. However, to walk in darkness, and thus give the lie to one’s fellowship with God, is akin to sinning with a high hand in the language of the Law, for which there was no forgiveness, and for which one was cut off from one's people (i.e. excommunicated). It is the sin of one in rebellion against God; it is sin that does not seek forgiveness. Indeed the one who commits it lies and says it is no sin, or worse, that he has no sin at all. To put it simply, John’s warning, just as the Old Covenant Law’s is against apostasy, or false faith. If one claims to trust in God but has no repentance he lies: to God, to others, and perhaps even to himself if he persist such that he hardens his heart. That is what it is to walk in darkness while claiming to be in the light. On the other hand, if we walk in the light of faith and repentance “we have fellowship with one another, and rthe blood of Jesus his Son cleanses us from all sin” (v. 7b).
So walk in the light!